@cedarjs/vite 4.0.0 → 4.0.1-next.67
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/apiDevServer.d.ts +18 -0
- package/dist/apiDevServer.d.ts.map +1 -0
- package/dist/apiDevServer.js +335 -0
- package/dist/buildUDApiServer.d.ts +22 -0
- package/dist/buildUDApiServer.d.ts.map +1 -0
- package/dist/buildUDApiServer.js +59 -0
- package/dist/bundled/react-server-dom-webpack.server.js +28528 -1231
- package/dist/cedar-unified-dev.d.ts +3 -0
- package/dist/cedar-unified-dev.d.ts.map +1 -0
- package/dist/cedar-unified-dev.js +65 -0
- package/dist/cjs/apiDevServer.js +366 -0
- package/dist/cjs/buildUDApiServer.js +93 -0
- package/dist/cjs/cedar-unified-dev.js +88 -0
- package/dist/cjs/index.js +9 -0
- package/dist/cjs/lib/getMergedConfig.js +5 -0
- package/dist/cjs/lib/workspacePackageAliases.js +113 -0
- package/dist/cjs/plugins/vite-plugin-cedar-dev-dispatcher.js +223 -0
- package/dist/cjs/plugins/vite-plugin-cedar-universal-deploy.js +63 -0
- package/dist/cjs/rsc/rscBuildAnalyze.js +2 -0
- package/dist/cjs/rsc/rscBuildForServer.js +2 -0
- package/dist/cjs/rsc/rscBuildForSsr.js +2 -0
- package/dist/cjs/rsc/rscStudioHandlers.js +2 -1
- package/dist/index.d.ts +3 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +6 -0
- package/dist/lib/getMergedConfig.d.ts.map +1 -1
- package/dist/lib/getMergedConfig.js +5 -0
- package/dist/lib/workspacePackageAliases.d.ts +18 -0
- package/dist/lib/workspacePackageAliases.d.ts.map +1 -0
- package/dist/lib/workspacePackageAliases.js +79 -0
- package/dist/plugins/vite-plugin-cedar-dev-dispatcher.d.ts +3 -0
- package/dist/plugins/vite-plugin-cedar-dev-dispatcher.d.ts.map +1 -0
- package/dist/plugins/vite-plugin-cedar-dev-dispatcher.js +189 -0
- package/dist/plugins/vite-plugin-cedar-universal-deploy.d.ts +6 -0
- package/dist/plugins/vite-plugin-cedar-universal-deploy.d.ts.map +1 -0
- package/dist/plugins/vite-plugin-cedar-universal-deploy.js +39 -0
- package/dist/rsc/rscBuildAnalyze.d.ts.map +1 -1
- package/dist/rsc/rscBuildAnalyze.js +2 -0
- package/dist/rsc/rscBuildForServer.d.ts.map +1 -1
- package/dist/rsc/rscBuildForServer.js +2 -0
- package/dist/rsc/rscBuildForSsr.d.ts.map +1 -1
- package/dist/rsc/rscBuildForSsr.js +2 -0
- package/dist/rsc/rscStudioHandlers.d.ts.map +1 -1
- package/dist/rsc/rscStudioHandlers.js +2 -1
- package/package.json +39 -19
- package/dist/cjs/rsc/rscWebSocketServer.js +0 -56
- package/dist/cjs/rsc/utils.js +0 -56
- package/dist/rsc/rscWebSocketServer.d.ts +0 -2
- package/dist/rsc/rscWebSocketServer.d.ts.map +0 -1
- package/dist/rsc/rscWebSocketServer.js +0 -22
- package/dist/rsc/utils.d.ts +0 -10
- package/dist/rsc/utils.d.ts.map +0 -1
- package/dist/rsc/utils.js +0 -21
- /package/bins/{rw-vite-build.mjs → cedar-vite-build.mjs} +0 -0
- /package/bins/{rw-vite-dev.mjs → cedar-vite-dev.mjs} +0 -0
|
@@ -0,0 +1,189 @@
|
|
|
1
|
+
import net from "node:net";
|
|
2
|
+
import path from "node:path";
|
|
3
|
+
import { getConfig, getPaths } from "@cedarjs/project-config";
|
|
4
|
+
let cachedDispatcher = null;
|
|
5
|
+
let dispatcherGeneration = 0;
|
|
6
|
+
let buildPromise = null;
|
|
7
|
+
async function getDispatcher() {
|
|
8
|
+
if (cachedDispatcher !== null) {
|
|
9
|
+
return cachedDispatcher;
|
|
10
|
+
}
|
|
11
|
+
if (buildPromise !== null) {
|
|
12
|
+
await buildPromise;
|
|
13
|
+
return cachedDispatcher ?? getDispatcher();
|
|
14
|
+
}
|
|
15
|
+
const generationAtStart = dispatcherGeneration;
|
|
16
|
+
buildPromise = (async () => {
|
|
17
|
+
try {
|
|
18
|
+
const { rebuildApi, buildApi } = await import("@cedarjs/internal/dist/build/api");
|
|
19
|
+
try {
|
|
20
|
+
await rebuildApi();
|
|
21
|
+
} catch {
|
|
22
|
+
await buildApi();
|
|
23
|
+
}
|
|
24
|
+
} catch (err) {
|
|
25
|
+
console.warn(
|
|
26
|
+
"[cedar-dev-dispatcher] API compilation failed; serving with last-known-good dist:",
|
|
27
|
+
err
|
|
28
|
+
);
|
|
29
|
+
}
|
|
30
|
+
const { buildCedarDispatcher } = await import("@cedarjs/api-server/udDispatcher");
|
|
31
|
+
const { fetchable } = await buildCedarDispatcher({ cacheBust: Date.now() });
|
|
32
|
+
if (generationAtStart === dispatcherGeneration) {
|
|
33
|
+
cachedDispatcher = fetchable;
|
|
34
|
+
}
|
|
35
|
+
return fetchable;
|
|
36
|
+
})();
|
|
37
|
+
try {
|
|
38
|
+
await buildPromise;
|
|
39
|
+
} finally {
|
|
40
|
+
if (generationAtStart === dispatcherGeneration) {
|
|
41
|
+
buildPromise = null;
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
if (cachedDispatcher !== null) {
|
|
45
|
+
return cachedDispatcher;
|
|
46
|
+
}
|
|
47
|
+
return getDispatcher();
|
|
48
|
+
}
|
|
49
|
+
function invalidateDispatcher() {
|
|
50
|
+
cachedDispatcher = null;
|
|
51
|
+
buildPromise = null;
|
|
52
|
+
dispatcherGeneration++;
|
|
53
|
+
}
|
|
54
|
+
function isViteInternalRequest(url) {
|
|
55
|
+
return url.startsWith("/@") || url.startsWith("/__vite") || url.startsWith("/__hmr") || url.includes("?import") || url.includes("?t=") || url.includes("?v=");
|
|
56
|
+
}
|
|
57
|
+
async function nodeRequestToFetch(req) {
|
|
58
|
+
const host = req.headers.host ?? "localhost";
|
|
59
|
+
const url = `http://${host}${req.url ?? "/"}`;
|
|
60
|
+
const headers = new Headers();
|
|
61
|
+
for (const [key, value] of Object.entries(req.headers)) {
|
|
62
|
+
if (value === void 0) {
|
|
63
|
+
continue;
|
|
64
|
+
}
|
|
65
|
+
if (Array.isArray(value)) {
|
|
66
|
+
for (const v of value) {
|
|
67
|
+
headers.append(key, v);
|
|
68
|
+
}
|
|
69
|
+
} else {
|
|
70
|
+
headers.set(key, value);
|
|
71
|
+
}
|
|
72
|
+
}
|
|
73
|
+
const method = (req.method ?? "GET").toUpperCase();
|
|
74
|
+
const hasBody = ["POST", "PUT", "PATCH", "DELETE"].includes(method);
|
|
75
|
+
let body;
|
|
76
|
+
if (hasBody) {
|
|
77
|
+
body = await new Promise((resolve, reject) => {
|
|
78
|
+
const chunks = [];
|
|
79
|
+
req.on("data", (chunk) => chunks.push(chunk));
|
|
80
|
+
req.on("end", () => resolve(Buffer.concat(chunks)));
|
|
81
|
+
req.on("error", reject);
|
|
82
|
+
});
|
|
83
|
+
}
|
|
84
|
+
return new Request(url, {
|
|
85
|
+
method,
|
|
86
|
+
headers,
|
|
87
|
+
body: hasBody && body && body.length > 0 ? new Uint8Array(body) : void 0
|
|
88
|
+
});
|
|
89
|
+
}
|
|
90
|
+
async function fetchResponseToNode(fetchRes, res) {
|
|
91
|
+
res.statusCode = fetchRes.status;
|
|
92
|
+
fetchRes.headers.forEach((value, key) => {
|
|
93
|
+
res.setHeader(key, value);
|
|
94
|
+
});
|
|
95
|
+
const bodyBuffer = await fetchRes.arrayBuffer();
|
|
96
|
+
if (bodyBuffer.byteLength > 0) {
|
|
97
|
+
res.end(Buffer.from(bodyBuffer));
|
|
98
|
+
} else {
|
|
99
|
+
res.end();
|
|
100
|
+
}
|
|
101
|
+
}
|
|
102
|
+
let apiServerIsUp;
|
|
103
|
+
async function checkApiPort(host, port) {
|
|
104
|
+
return new Promise((resolve) => {
|
|
105
|
+
const socket = new net.Socket();
|
|
106
|
+
socket.setTimeout(100);
|
|
107
|
+
socket.on("connect", () => {
|
|
108
|
+
socket.destroy();
|
|
109
|
+
resolve(true);
|
|
110
|
+
});
|
|
111
|
+
socket.on("timeout", () => {
|
|
112
|
+
socket.destroy();
|
|
113
|
+
resolve(false);
|
|
114
|
+
});
|
|
115
|
+
socket.on("error", () => {
|
|
116
|
+
socket.destroy();
|
|
117
|
+
resolve(false);
|
|
118
|
+
});
|
|
119
|
+
socket.connect(port, host);
|
|
120
|
+
});
|
|
121
|
+
}
|
|
122
|
+
function cedarDevDispatcherPlugin() {
|
|
123
|
+
return {
|
|
124
|
+
name: "cedar-dev-dispatcher",
|
|
125
|
+
apply: "serve",
|
|
126
|
+
configureServer(server) {
|
|
127
|
+
const cedarConfig = getConfig();
|
|
128
|
+
const apiUrl = cedarConfig.web.apiUrl.replace(/\/$/, "");
|
|
129
|
+
const apiGqlUrl = cedarConfig.web.apiGraphQLUrl ?? apiUrl + "/graphql";
|
|
130
|
+
const apiPort = cedarConfig.api.port;
|
|
131
|
+
const apiHost = cedarConfig.api.host || "127.0.0.1";
|
|
132
|
+
function isApiRequest(url) {
|
|
133
|
+
return url === apiUrl || url.startsWith(apiUrl + "/") || url.startsWith(apiUrl + "?") || url === apiGqlUrl || url.startsWith(apiGqlUrl + "/") || url.startsWith(apiGqlUrl + "?");
|
|
134
|
+
}
|
|
135
|
+
server.watcher.on("change", (filePath) => {
|
|
136
|
+
if (filePath.startsWith(getPaths().api.src + path.sep)) {
|
|
137
|
+
invalidateDispatcher();
|
|
138
|
+
}
|
|
139
|
+
});
|
|
140
|
+
server.middlewares.use(
|
|
141
|
+
async (req, res, next) => {
|
|
142
|
+
const url = req.url ?? "/";
|
|
143
|
+
if (isViteInternalRequest(url)) {
|
|
144
|
+
return next();
|
|
145
|
+
}
|
|
146
|
+
if (!isApiRequest(url)) {
|
|
147
|
+
return next();
|
|
148
|
+
}
|
|
149
|
+
if (apiServerIsUp === void 0) {
|
|
150
|
+
apiServerIsUp = await checkApiPort(apiHost, apiPort);
|
|
151
|
+
}
|
|
152
|
+
if (apiServerIsUp) {
|
|
153
|
+
return next();
|
|
154
|
+
}
|
|
155
|
+
try {
|
|
156
|
+
const dispatcher = await getDispatcher();
|
|
157
|
+
const fetchRequest = await nodeRequestToFetch(req);
|
|
158
|
+
const fetchResponse = await dispatcher.fetch(fetchRequest);
|
|
159
|
+
await fetchResponseToNode(fetchResponse, res);
|
|
160
|
+
} catch (err) {
|
|
161
|
+
console.error(
|
|
162
|
+
"[cedar-dev-dispatcher] Error handling API request:",
|
|
163
|
+
err
|
|
164
|
+
);
|
|
165
|
+
if (!res.headersSent) {
|
|
166
|
+
res.writeHead(500, { "Content-Type": "application/json" });
|
|
167
|
+
}
|
|
168
|
+
res.end(
|
|
169
|
+
JSON.stringify(
|
|
170
|
+
{
|
|
171
|
+
errors: [
|
|
172
|
+
{
|
|
173
|
+
message: err instanceof Error ? err.message : "Internal Server Error"
|
|
174
|
+
}
|
|
175
|
+
]
|
|
176
|
+
},
|
|
177
|
+
null,
|
|
178
|
+
2
|
|
179
|
+
)
|
|
180
|
+
);
|
|
181
|
+
}
|
|
182
|
+
}
|
|
183
|
+
);
|
|
184
|
+
}
|
|
185
|
+
};
|
|
186
|
+
}
|
|
187
|
+
export {
|
|
188
|
+
cedarDevDispatcherPlugin
|
|
189
|
+
};
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import type { Plugin } from 'vite';
|
|
2
|
+
export interface CedarUniversalDeployPluginOptions {
|
|
3
|
+
apiRootPath?: string;
|
|
4
|
+
}
|
|
5
|
+
export declare function cedarUniversalDeployPlugin(options?: CedarUniversalDeployPluginOptions): Plugin;
|
|
6
|
+
//# sourceMappingURL=vite-plugin-cedar-universal-deploy.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"vite-plugin-cedar-universal-deploy.d.ts","sourceRoot":"","sources":["../../src/plugins/vite-plugin-cedar-universal-deploy.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,MAAM,CAAA;AAElC,MAAM,WAAW,iCAAiC;IAChD,WAAW,CAAC,EAAE,MAAM,CAAA;CACrB;AAKD,wBAAgB,0BAA0B,CACxC,OAAO,GAAE,iCAAsC,GAC9C,MAAM,CA2CR"}
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
import { addEntry, catchAllEntry } from "@universal-deploy/store";
|
|
2
|
+
const VIRTUAL_CEDAR_API = "virtual:cedar-api";
|
|
3
|
+
const RESOLVED_VIRTUAL_CEDAR_API = "\0virtual:cedar-api";
|
|
4
|
+
function cedarUniversalDeployPlugin(options = {}) {
|
|
5
|
+
const { apiRootPath } = options;
|
|
6
|
+
return {
|
|
7
|
+
name: "cedar-universal-deploy",
|
|
8
|
+
apply: "build",
|
|
9
|
+
buildStart() {
|
|
10
|
+
addEntry({
|
|
11
|
+
id: VIRTUAL_CEDAR_API,
|
|
12
|
+
route: "/**"
|
|
13
|
+
});
|
|
14
|
+
},
|
|
15
|
+
resolveId(id) {
|
|
16
|
+
if (id === catchAllEntry) {
|
|
17
|
+
return RESOLVED_VIRTUAL_CEDAR_API;
|
|
18
|
+
}
|
|
19
|
+
if (id === VIRTUAL_CEDAR_API) {
|
|
20
|
+
return RESOLVED_VIRTUAL_CEDAR_API;
|
|
21
|
+
}
|
|
22
|
+
return void 0;
|
|
23
|
+
},
|
|
24
|
+
load(id) {
|
|
25
|
+
if (id !== RESOLVED_VIRTUAL_CEDAR_API) {
|
|
26
|
+
return void 0;
|
|
27
|
+
}
|
|
28
|
+
const apiRootPathArg = apiRootPath !== void 0 ? `{ apiRootPath: ${JSON.stringify(apiRootPath)} }` : "undefined";
|
|
29
|
+
return `
|
|
30
|
+
import { buildCedarDispatcher } from '@cedarjs/api-server/udDispatcher';
|
|
31
|
+
const { fetchable } = await buildCedarDispatcher(${apiRootPathArg});
|
|
32
|
+
export default fetchable;
|
|
33
|
+
`;
|
|
34
|
+
}
|
|
35
|
+
};
|
|
36
|
+
}
|
|
37
|
+
export {
|
|
38
|
+
cedarUniversalDeployPlugin
|
|
39
|
+
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"rscBuildAnalyze.d.ts","sourceRoot":"","sources":["../../src/rsc/rscBuildAnalyze.ts"],"names":[],"mappings":"AAQA;;;;;;GAMG;AACH,wBAAsB,eAAe;;;;;;;
|
|
1
|
+
{"version":3,"file":"rscBuildAnalyze.d.ts","sourceRoot":"","sources":["../../src/rsc/rscBuildAnalyze.ts"],"names":[],"mappings":"AAQA;;;;;;GAMG;AACH,wBAAsB,eAAe;;;;;;;GA0GpC"}
|
|
@@ -43,6 +43,7 @@ async function rscBuildAnalyze() {
|
|
|
43
43
|
"better-sqlite3",
|
|
44
44
|
"@cedarjs/auth-dbauth-api",
|
|
45
45
|
"@cedarjs/cookie-jar",
|
|
46
|
+
"@cedarjs/realtime",
|
|
46
47
|
"@cedarjs/server-store",
|
|
47
48
|
"@simplewebauthn/server",
|
|
48
49
|
"graphql-scalars",
|
|
@@ -72,6 +73,7 @@ async function rscBuildAnalyze() {
|
|
|
72
73
|
ssr: true,
|
|
73
74
|
rollupOptions: {
|
|
74
75
|
onwarn: onWarn,
|
|
76
|
+
external: ["@cedarjs/realtime"],
|
|
75
77
|
input: getEntries()
|
|
76
78
|
}
|
|
77
79
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"rscBuildForServer.d.ts","sourceRoot":"","sources":["../../src/rsc/rscBuildForServer.ts"],"names":[],"mappings":"AAUA;;;;GAIG;AACH,wBAAsB,iBAAiB,CACrC,gBAAgB,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,EACxC,gBAAgB,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,EACxC,aAAa,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,+
|
|
1
|
+
{"version":3,"file":"rscBuildForServer.d.ts","sourceRoot":"","sources":["../../src/rsc/rscBuildForServer.ts"],"names":[],"mappings":"AAUA;;;;GAIG;AACH,wBAAsB,iBAAiB,CACrC,gBAAgB,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,EACxC,gBAAgB,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,EACxC,aAAa,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,+GAoJtC"}
|
|
@@ -45,6 +45,7 @@ async function rscBuildForServer(clientEntryFiles, serverEntryFiles, customModul
|
|
|
45
45
|
"better-sqlite3",
|
|
46
46
|
"@cedarjs/auth-dbauth-api",
|
|
47
47
|
"@cedarjs/cookie-jar",
|
|
48
|
+
"@cedarjs/realtime",
|
|
48
49
|
"@cedarjs/server-store",
|
|
49
50
|
"@simplewebauthn/server",
|
|
50
51
|
"graphql-scalars",
|
|
@@ -91,6 +92,7 @@ async function rscBuildForServer(clientEntryFiles, serverEntryFiles, customModul
|
|
|
91
92
|
manifest: "server-build-manifest.json",
|
|
92
93
|
rollupOptions: {
|
|
93
94
|
onwarn: onWarn,
|
|
95
|
+
external: ["@cedarjs/realtime"],
|
|
94
96
|
input: {
|
|
95
97
|
...entryFiles,
|
|
96
98
|
...clientEntryFiles,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"rscBuildForSsr.d.ts","sourceRoot":"","sources":["../../src/rsc/rscBuildForSsr.ts"],"names":[],"mappings":"AAWA;;;GAGG;AACH,wBAAsB,cAAc,CAAC,EACnC,gBAAgB,EAChB,OAAe,GAChB,EAAE;IACD,gBAAgB,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAA;IACxC,OAAO,CAAC,EAAE,OAAO,CAAA;CAClB,+
|
|
1
|
+
{"version":3,"file":"rscBuildForSsr.d.ts","sourceRoot":"","sources":["../../src/rsc/rscBuildForSsr.ts"],"names":[],"mappings":"AAWA;;;GAGG;AACH,wBAAsB,cAAc,CAAC,EACnC,gBAAgB,EAChB,OAAe,GAChB,EAAE;IACD,gBAAgB,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAA;IACxC,OAAO,CAAC,EAAE,OAAO,CAAA;CAClB,+GA+IA"}
|
|
@@ -40,6 +40,7 @@ async function rscBuildForSsr({
|
|
|
40
40
|
"better-sqlite3",
|
|
41
41
|
"@cedarjs/auth-dbauth-api",
|
|
42
42
|
"@cedarjs/cookie-jar",
|
|
43
|
+
"@cedarjs/realtime",
|
|
43
44
|
"@cedarjs/server-store",
|
|
44
45
|
"@simplewebauthn/server",
|
|
45
46
|
"graphql-scalars",
|
|
@@ -69,6 +70,7 @@ async function rscBuildForSsr({
|
|
|
69
70
|
// Needed because `outDir` is not inside `root`
|
|
70
71
|
rollupOptions: {
|
|
71
72
|
onwarn: onWarn,
|
|
73
|
+
external: ["@cedarjs/realtime"],
|
|
72
74
|
input: {
|
|
73
75
|
// @MARK: temporary hack to find the entry client so we can get the
|
|
74
76
|
// index.css bundle but we don't actually want this on an rsc page!
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"rscStudioHandlers.d.ts","sourceRoot":"","sources":["../../src/rsc/rscStudioHandlers.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,SAAS,CAAA;AAKtC,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,kBAAkB,CAAA;
|
|
1
|
+
{"version":3,"file":"rscStudioHandlers.d.ts","sourceRoot":"","sources":["../../src/rsc/rscStudioHandlers.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,SAAS,CAAA;AAKtC,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,kBAAkB,CAAA;AA0GnD,UAAU,iBAAkB,SAAQ,IAAI,CAAC,WAAW,EAAE,aAAa,CAAC;IAClE,QAAQ,EAAE,MAAM,CAAA;IAChB,GAAG,EAAE,OAAO,CAAA;IACZ,WAAW,EAAE,CAAC,CAAC,EAAE,KAAK,KAAK,IAAI,CAAA;CAChC;AAED,eAAO,MAAM,qBAAqB,GAAU,OAAO,iBAAiB,kBA8CnE,CAAA"}
|
|
@@ -46,10 +46,11 @@ const postFlightToStudio = (payload, metadata) => {
|
|
|
46
46
|
encodedMetadata
|
|
47
47
|
}
|
|
48
48
|
});
|
|
49
|
+
const apiUrl = getConfig().web.apiUrl.replace(/\/$/, "");
|
|
49
50
|
const options = {
|
|
50
51
|
hostname: "localhost",
|
|
51
52
|
port: getStudioPort(),
|
|
52
|
-
path:
|
|
53
|
+
path: `${apiUrl}/rsc-flight`,
|
|
53
54
|
method: "POST",
|
|
54
55
|
headers: {
|
|
55
56
|
"Content-Type": "application/json",
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@cedarjs/vite",
|
|
3
|
-
"version": "4.0.
|
|
3
|
+
"version": "4.0.1-next.67+ad97a60c79",
|
|
4
4
|
"description": "Vite configuration package for CedarJS",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
@@ -25,6 +25,12 @@
|
|
|
25
25
|
"types": "./dist/api/vite-plugin-cedar-vitest-api-preset.d.ts",
|
|
26
26
|
"default": "./dist/api/vite-plugin-cedar-vitest-api-preset.js"
|
|
27
27
|
},
|
|
28
|
+
"./apiDevServer": {
|
|
29
|
+
"import": {
|
|
30
|
+
"types": "./dist/apiDevServer.d.ts",
|
|
31
|
+
"default": "./dist/apiDevServer.js"
|
|
32
|
+
}
|
|
33
|
+
},
|
|
28
34
|
"./client": {
|
|
29
35
|
"require": "./dist/cjs/client.js",
|
|
30
36
|
"import": "./dist/client.js"
|
|
@@ -33,21 +39,26 @@
|
|
|
33
39
|
"require": "./dist/cjs/buildFeServer.js",
|
|
34
40
|
"import": "./dist/buildFeServer.js"
|
|
35
41
|
},
|
|
42
|
+
"./buildUDApiServer": {
|
|
43
|
+
"import": "./dist/buildUDApiServer.js"
|
|
44
|
+
},
|
|
36
45
|
"./build": {
|
|
37
46
|
"import": "./dist/build/build.js",
|
|
38
47
|
"default": "./dist/cjs/build/build.js"
|
|
39
48
|
},
|
|
40
|
-
"./bins/
|
|
49
|
+
"./bins/cedar-vite-build.mjs": "./bins/cedar-vite-build.mjs"
|
|
41
50
|
},
|
|
42
51
|
"bin": {
|
|
43
|
-
"
|
|
44
|
-
"
|
|
45
|
-
"
|
|
46
|
-
"
|
|
52
|
+
"cedar-dev-fe": "./dist/devFeServer.js",
|
|
53
|
+
"cedar-serve-fe": "./dist/runFeServer.js",
|
|
54
|
+
"cedar-unified-dev": "./dist/cedar-unified-dev.js",
|
|
55
|
+
"cedar-vite-build": "./bins/cedar-vite-build.mjs",
|
|
56
|
+
"cedar-vite-dev": "./bins/cedar-vite-dev.mjs",
|
|
47
57
|
"vite": "./bins/vite.mjs"
|
|
48
58
|
},
|
|
49
59
|
"files": [
|
|
50
60
|
"dist",
|
|
61
|
+
"bins",
|
|
51
62
|
"inject"
|
|
52
63
|
],
|
|
53
64
|
"scripts": {
|
|
@@ -64,28 +75,36 @@
|
|
|
64
75
|
"@babel/generator": "7.29.1",
|
|
65
76
|
"@babel/parser": "7.29.2",
|
|
66
77
|
"@babel/traverse": "7.29.0",
|
|
67
|
-
"@cedarjs/
|
|
68
|
-
"@cedarjs/
|
|
69
|
-
"@cedarjs/
|
|
70
|
-
"@cedarjs/
|
|
71
|
-
"@cedarjs/
|
|
72
|
-
"@cedarjs/server
|
|
73
|
-
"@cedarjs/
|
|
74
|
-
"@cedarjs/
|
|
75
|
-
"@
|
|
78
|
+
"@cedarjs/api-server": "4.0.1-next.67+ad97a60c79",
|
|
79
|
+
"@cedarjs/auth": "4.0.1-next.67+ad97a60c79",
|
|
80
|
+
"@cedarjs/babel-config": "4.0.1-next.67+ad97a60c79",
|
|
81
|
+
"@cedarjs/context": "4.0.1-next.67+ad97a60c79",
|
|
82
|
+
"@cedarjs/cookie-jar": "4.0.1-next.67+ad97a60c79",
|
|
83
|
+
"@cedarjs/graphql-server": "4.0.1-next.67+ad97a60c79",
|
|
84
|
+
"@cedarjs/internal": "4.0.1-next.67+ad97a60c79",
|
|
85
|
+
"@cedarjs/project-config": "4.0.1-next.67+ad97a60c79",
|
|
86
|
+
"@cedarjs/server-store": "4.0.1-next.67+ad97a60c79",
|
|
87
|
+
"@cedarjs/testing": "4.0.1-next.67+ad97a60c79",
|
|
88
|
+
"@cedarjs/web": "4.0.1-next.67+ad97a60c79",
|
|
89
|
+
"@fastify/url-data": "6.0.3",
|
|
90
|
+
"@swc/core": "1.15.30",
|
|
91
|
+
"@universal-deploy/node": "^0.1.6",
|
|
76
92
|
"@vitejs/plugin-react": "4.7.0",
|
|
77
93
|
"@whatwg-node/fetch": "0.10.13",
|
|
78
94
|
"@whatwg-node/server": "0.10.18",
|
|
79
95
|
"acorn-loose": "8.5.2",
|
|
96
|
+
"ansis": "4.2.0",
|
|
80
97
|
"buffer": "6.0.3",
|
|
81
98
|
"busboy": "^1.6.0",
|
|
82
99
|
"cookie": "1.1.1",
|
|
83
100
|
"dotenv-defaults": "5.0.2",
|
|
84
101
|
"execa": "5.1.1",
|
|
85
102
|
"express": "4.22.1",
|
|
103
|
+
"fastify": "5.8.5",
|
|
104
|
+
"fastify-raw-body": "5.0.0",
|
|
86
105
|
"find-my-way": "8.2.2",
|
|
87
106
|
"http-proxy-middleware": "3.0.5",
|
|
88
|
-
"isbot": "5.1.
|
|
107
|
+
"isbot": "5.1.39",
|
|
89
108
|
"react": "18.3.1",
|
|
90
109
|
"react-server-dom-webpack": "19.2.4",
|
|
91
110
|
"rimraf": "6.1.3",
|
|
@@ -98,6 +117,7 @@
|
|
|
98
117
|
"devDependencies": {
|
|
99
118
|
"@arethetypeswrong/cli": "0.18.2",
|
|
100
119
|
"@hyrious/esbuild-plugin-commonjs": "0.2.6",
|
|
120
|
+
"@types/aws-lambda": "8.10.161",
|
|
101
121
|
"@types/busboy": "^1",
|
|
102
122
|
"@types/express": "4",
|
|
103
123
|
"@types/react": "^18.2.55",
|
|
@@ -105,9 +125,9 @@
|
|
|
105
125
|
"@types/yargs-parser": "21.0.3",
|
|
106
126
|
"concurrently": "9.2.1",
|
|
107
127
|
"glob": "11.1.0",
|
|
108
|
-
"memfs": "4.57.
|
|
128
|
+
"memfs": "4.57.2",
|
|
109
129
|
"publint": "0.3.18",
|
|
110
|
-
"rollup": "4.60.
|
|
130
|
+
"rollup": "4.60.2",
|
|
111
131
|
"tsx": "4.21.0",
|
|
112
132
|
"typescript": "5.9.3",
|
|
113
133
|
"vitest": "3.2.4"
|
|
@@ -118,5 +138,5 @@
|
|
|
118
138
|
"publishConfig": {
|
|
119
139
|
"access": "public"
|
|
120
140
|
},
|
|
121
|
-
"gitHead": "
|
|
141
|
+
"gitHead": "ad97a60c793c21b3263b4178e339d89406f7a7a3"
|
|
122
142
|
}
|
|
@@ -1,56 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __create = Object.create;
|
|
3
|
-
var __defProp = Object.defineProperty;
|
|
4
|
-
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
5
|
-
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
6
|
-
var __getProtoOf = Object.getPrototypeOf;
|
|
7
|
-
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
8
|
-
var __export = (target, all) => {
|
|
9
|
-
for (var name in all)
|
|
10
|
-
__defProp(target, name, { get: all[name], enumerable: true });
|
|
11
|
-
};
|
|
12
|
-
var __copyProps = (to, from, except, desc) => {
|
|
13
|
-
if (from && typeof from === "object" || typeof from === "function") {
|
|
14
|
-
for (let key of __getOwnPropNames(from))
|
|
15
|
-
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
16
|
-
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
17
|
-
}
|
|
18
|
-
return to;
|
|
19
|
-
};
|
|
20
|
-
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
21
|
-
// If the importer is in node compatibility mode or this is not an ESM
|
|
22
|
-
// file that has been converted to a CommonJS file using a Babel-
|
|
23
|
-
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
24
|
-
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
25
|
-
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
26
|
-
mod
|
|
27
|
-
));
|
|
28
|
-
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
29
|
-
var rscWebSocketServer_exports = {};
|
|
30
|
-
__export(rscWebSocketServer_exports, {
|
|
31
|
-
createWebSocketServer: () => createWebSocketServer
|
|
32
|
-
});
|
|
33
|
-
module.exports = __toCommonJS(rscWebSocketServer_exports);
|
|
34
|
-
var import_ws = __toESM(require("ws"), 1);
|
|
35
|
-
function createWebSocketServer() {
|
|
36
|
-
const wsServer = new import_ws.WebSocketServer({ port: 18998 });
|
|
37
|
-
wsServer.on("connection", (ws) => {
|
|
38
|
-
console.log("A new client connected.");
|
|
39
|
-
ws.on("message", (data) => {
|
|
40
|
-
const message = data.toString();
|
|
41
|
-
console.log("Received message:", message);
|
|
42
|
-
wsServer.clients.forEach((client) => {
|
|
43
|
-
if (client.readyState === import_ws.default.OPEN) {
|
|
44
|
-
client.send(message);
|
|
45
|
-
}
|
|
46
|
-
});
|
|
47
|
-
});
|
|
48
|
-
ws.on("close", () => {
|
|
49
|
-
console.log("A client disconnected.");
|
|
50
|
-
});
|
|
51
|
-
});
|
|
52
|
-
}
|
|
53
|
-
// Annotate the CommonJS export names for ESM import in node:
|
|
54
|
-
0 && (module.exports = {
|
|
55
|
-
createWebSocketServer
|
|
56
|
-
});
|
package/dist/cjs/rsc/utils.js
DELETED
|
@@ -1,56 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __create = Object.create;
|
|
3
|
-
var __defProp = Object.defineProperty;
|
|
4
|
-
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
5
|
-
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
6
|
-
var __getProtoOf = Object.getPrototypeOf;
|
|
7
|
-
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
8
|
-
var __export = (target, all) => {
|
|
9
|
-
for (var name in all)
|
|
10
|
-
__defProp(target, name, { get: all[name], enumerable: true });
|
|
11
|
-
};
|
|
12
|
-
var __copyProps = (to, from, except, desc) => {
|
|
13
|
-
if (from && typeof from === "object" || typeof from === "function") {
|
|
14
|
-
for (let key of __getOwnPropNames(from))
|
|
15
|
-
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
16
|
-
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
17
|
-
}
|
|
18
|
-
return to;
|
|
19
|
-
};
|
|
20
|
-
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
21
|
-
// If the importer is in node compatibility mode or this is not an ESM
|
|
22
|
-
// file that has been converted to a CommonJS file using a Babel-
|
|
23
|
-
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
24
|
-
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
25
|
-
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
26
|
-
mod
|
|
27
|
-
));
|
|
28
|
-
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
29
|
-
var utils_exports = {};
|
|
30
|
-
__export(utils_exports, {
|
|
31
|
-
importRscReact: () => importRscReact,
|
|
32
|
-
importRsdwServer: () => importRsdwServer
|
|
33
|
-
});
|
|
34
|
-
module.exports = __toCommonJS(utils_exports);
|
|
35
|
-
async function importRscReact() {
|
|
36
|
-
if (globalThis.__cedarjs__vite_rsc_runtime) {
|
|
37
|
-
const reactMod = await globalThis.__cedarjs__vite_rsc_runtime.import("react");
|
|
38
|
-
return reactMod.default;
|
|
39
|
-
}
|
|
40
|
-
return import("react");
|
|
41
|
-
}
|
|
42
|
-
async function importRsdwServer() {
|
|
43
|
-
if (globalThis.__cedarjs__vite_rsc_runtime) {
|
|
44
|
-
const rsdwServerMod = await globalThis.__cedarjs__vite_rsc_runtime.import(
|
|
45
|
-
"react-server-dom-webpack/server.edge"
|
|
46
|
-
);
|
|
47
|
-
return rsdwServerMod.default;
|
|
48
|
-
} else {
|
|
49
|
-
return import("react-server-dom-webpack/server.edge");
|
|
50
|
-
}
|
|
51
|
-
}
|
|
52
|
-
// Annotate the CommonJS export names for ESM import in node:
|
|
53
|
-
0 && (module.exports = {
|
|
54
|
-
importRscReact,
|
|
55
|
-
importRsdwServer
|
|
56
|
-
});
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"rscWebSocketServer.d.ts","sourceRoot":"","sources":["../../src/rsc/rscWebSocketServer.ts"],"names":[],"mappings":"AAEA,wBAAgB,qBAAqB,SAwBpC"}
|
|
@@ -1,22 +0,0 @@
|
|
|
1
|
-
import WebSocket, { WebSocketServer } from "ws";
|
|
2
|
-
function createWebSocketServer() {
|
|
3
|
-
const wsServer = new WebSocketServer({ port: 18998 });
|
|
4
|
-
wsServer.on("connection", (ws) => {
|
|
5
|
-
console.log("A new client connected.");
|
|
6
|
-
ws.on("message", (data) => {
|
|
7
|
-
const message = data.toString();
|
|
8
|
-
console.log("Received message:", message);
|
|
9
|
-
wsServer.clients.forEach((client) => {
|
|
10
|
-
if (client.readyState === WebSocket.OPEN) {
|
|
11
|
-
client.send(message);
|
|
12
|
-
}
|
|
13
|
-
});
|
|
14
|
-
});
|
|
15
|
-
ws.on("close", () => {
|
|
16
|
-
console.log("A client disconnected.");
|
|
17
|
-
});
|
|
18
|
-
});
|
|
19
|
-
}
|
|
20
|
-
export {
|
|
21
|
-
createWebSocketServer
|
|
22
|
-
};
|
package/dist/rsc/utils.d.ts
DELETED
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
import type { default as RSDWServerModule } from 'react-server-dom-webpack/server.edge';
|
|
2
|
-
type RSDWServerType = typeof RSDWServerModule;
|
|
3
|
-
/**
|
|
4
|
-
* This function ensures we load the version of React that's been imported with
|
|
5
|
-
* the react-server condition.
|
|
6
|
-
*/
|
|
7
|
-
export declare function importRscReact(): Promise<any>;
|
|
8
|
-
export declare function importRsdwServer(): Promise<RSDWServerType>;
|
|
9
|
-
export {};
|
|
10
|
-
//# sourceMappingURL=utils.d.ts.map
|
package/dist/rsc/utils.d.ts.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../../src/rsc/utils.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,IAAI,gBAAgB,EAAE,MAAM,sCAAsC,CAAA;AAEvF,KAAK,cAAc,GAAG,OAAO,gBAAgB,CAAA;AAE7C;;;GAGG;AACH,wBAAsB,cAAc,iBAQnC;AAED,wBAAsB,gBAAgB,IAAI,OAAO,CAAC,cAAc,CAAC,CAUhE"}
|
package/dist/rsc/utils.js
DELETED
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
async function importRscReact() {
|
|
2
|
-
if (globalThis.__cedarjs__vite_rsc_runtime) {
|
|
3
|
-
const reactMod = await globalThis.__cedarjs__vite_rsc_runtime.import("react");
|
|
4
|
-
return reactMod.default;
|
|
5
|
-
}
|
|
6
|
-
return import("react");
|
|
7
|
-
}
|
|
8
|
-
async function importRsdwServer() {
|
|
9
|
-
if (globalThis.__cedarjs__vite_rsc_runtime) {
|
|
10
|
-
const rsdwServerMod = await globalThis.__cedarjs__vite_rsc_runtime.import(
|
|
11
|
-
"react-server-dom-webpack/server.edge"
|
|
12
|
-
);
|
|
13
|
-
return rsdwServerMod.default;
|
|
14
|
-
} else {
|
|
15
|
-
return import("react-server-dom-webpack/server.edge");
|
|
16
|
-
}
|
|
17
|
-
}
|
|
18
|
-
export {
|
|
19
|
-
importRscReact,
|
|
20
|
-
importRsdwServer
|
|
21
|
-
};
|
|
File without changes
|
|
File without changes
|