@cedarjs/vite 7.0.0-canary.3259 → 7.0.0-rc.123
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/buildApp.d.ts.map +1 -1
- package/dist/buildApp.js +7 -3
- package/dist/buildRouteHooks.d.ts +13 -7
- package/dist/buildRouteHooks.d.ts.map +1 -1
- package/dist/buildRouteHooks.js +10 -5
- package/dist/bundled/react-server-dom-webpack.server.js +29125 -2264
- package/dist/devFeServer.js +19 -278
- package/dist/index.d.ts +0 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +0 -4
- package/dist/lib/registerFwGlobalsAndShims.js +0 -9
- package/dist/middleware/types.d.ts +1 -4
- package/dist/middleware/types.d.ts.map +1 -1
- package/dist/plugins/vite-plugin-cedar-cell.d.ts +1 -2
- package/dist/plugins/vite-plugin-cedar-cell.d.ts.map +1 -1
- package/dist/plugins/vite-plugin-cedar-cell.js +11 -30
- package/dist/plugins/vite-plugin-cedar-mock-cell-data.d.ts.map +1 -1
- package/dist/plugins/vite-plugin-handler-als-wrapping.d.ts +6 -2
- package/dist/plugins/vite-plugin-handler-als-wrapping.d.ts.map +1 -1
- package/dist/plugins/vite-plugin-handler-als-wrapping.js +7 -4
- package/dist/plugins/vite-plugin-rsc-ssr-router-import.d.ts.map +1 -1
- package/dist/plugins/vite-plugin-rsc-ssr-router-import.js +2 -2
- package/dist/plugins/vite-plugin-rsc-transform-server.d.ts.map +1 -1
- package/dist/plugins/vite-plugin-rsc-transform-server.js +0 -4
- package/dist/rsc/rscRenderer.d.ts.map +1 -1
- package/dist/rsc/rscRenderer.js +5 -19
- package/dist/rsc/rscRequestHandler.d.ts +2 -2
- package/dist/rsc/rscRequestHandler.d.ts.map +1 -1
- package/dist/rsc/rscRequestHandler.js +4 -4
- package/dist/runFeServer.js +24 -5
- package/dist/streaming/createReactStreamingHandler.d.ts +1 -1
- package/dist/streaming/createReactStreamingHandler.d.ts.map +1 -1
- package/dist/streaming/createReactStreamingHandler.js +10 -13
- package/dist/streaming/streamHelpers.d.ts +3 -8
- package/dist/streaming/streamHelpers.d.ts.map +1 -1
- package/dist/streaming/streamHelpers.js +32 -50
- package/dist/streaming/triggerRouteHooks.d.ts +2 -2
- package/dist/streaming/triggerRouteHooks.d.ts.map +1 -1
- package/dist/streaming/triggerRouteHooks.js +3 -3
- package/package.json +29 -31
- package/dist/plugins/vite-plugin-cedar-parsed-scalars.d.ts +0 -20
- package/dist/plugins/vite-plugin-cedar-parsed-scalars.d.ts.map +0 -1
- package/dist/plugins/vite-plugin-cedar-parsed-scalars.js +0 -60
- 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/dist/devFeServer.js
CHANGED
|
@@ -1,12 +1,7 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
import http from "node:http";
|
|
3
2
|
import { createServerAdapter } from "@whatwg-node/server";
|
|
4
3
|
import express from "express";
|
|
5
|
-
import {
|
|
6
|
-
createServer as createViteServer,
|
|
7
|
-
createServerModuleRunner,
|
|
8
|
-
defaultServerConditions
|
|
9
|
-
} from "vite";
|
|
4
|
+
import { createServer as createViteServer } from "vite";
|
|
10
5
|
import { cjsInterop } from "vite-plugin-cjs-interop";
|
|
11
6
|
import { getProjectRoutes } from "@cedarjs/internal/dist/routes.js";
|
|
12
7
|
import { getConfig, getPaths } from "@cedarjs/project-config";
|
|
@@ -15,10 +10,6 @@ import { registerFwGlobalsAndShims } from "./lib/registerFwGlobalsAndShims.js";
|
|
|
15
10
|
import { invoke } from "./middleware/invokeMiddleware.js";
|
|
16
11
|
import { createMiddlewareRouter } from "./middleware/register.js";
|
|
17
12
|
import { rscRoutesAutoLoader } from "./plugins/vite-plugin-rsc-routes-auto-loader.js";
|
|
18
|
-
import { rscRoutesImports } from "./plugins/vite-plugin-rsc-routes-imports.js";
|
|
19
|
-
import { rscSsrRouterImport } from "./plugins/vite-plugin-rsc-ssr-router-import.js";
|
|
20
|
-
import { rscTransformUseServerPlugin } from "./plugins/vite-plugin-rsc-transform-server.js";
|
|
21
|
-
import { createWebSocketServer } from "./rsc/rscWebSocketServer.js";
|
|
22
13
|
import { collectCssPaths, componentsModules } from "./streaming/collectCss.js";
|
|
23
14
|
import { createReactStreamingHandler } from "./streaming/createReactStreamingHandler.js";
|
|
24
15
|
import {
|
|
@@ -27,17 +18,14 @@ import {
|
|
|
27
18
|
getFullUrl
|
|
28
19
|
} from "./utils.js";
|
|
29
20
|
globalThis.__REDWOOD__PRERENDER_PAGES = {};
|
|
30
|
-
globalThis.__cedarjs__vite_ssr_runtime = void 0;
|
|
31
|
-
globalThis.__cedarjs__vite_rsc_runtime = void 0;
|
|
32
21
|
async function createServer() {
|
|
33
22
|
ensureProcessDirWeb();
|
|
34
23
|
registerFwGlobalsAndShims();
|
|
35
24
|
const app = express();
|
|
36
|
-
const server = http.createServer(app);
|
|
37
25
|
const rwPaths = getPaths();
|
|
38
26
|
const rscEnabled = getConfig().experimental.rsc?.enabled ?? false;
|
|
39
27
|
const serverStorage = createServerStorage();
|
|
40
|
-
app.use((req, _res, next) => {
|
|
28
|
+
app.use("*", (req, _res, next) => {
|
|
41
29
|
const fullUrl = getFullUrl(req, rscEnabled);
|
|
42
30
|
const perReqStore = createPerRequestMap({
|
|
43
31
|
// Convert express headers to fetch header
|
|
@@ -56,78 +44,8 @@ async function createServer() {
|
|
|
56
44
|
"Vite config not found. Please set up Vite before running the dev server."
|
|
57
45
|
);
|
|
58
46
|
}
|
|
59
|
-
const
|
|
47
|
+
const vite = await createViteServer({
|
|
60
48
|
configFile: rwPaths.web.viteConfig,
|
|
61
|
-
envFile: false,
|
|
62
|
-
define: {
|
|
63
|
-
"process.env.NODE_ENV": JSON.stringify(process.env.NODE_ENV)
|
|
64
|
-
},
|
|
65
|
-
ssr: {
|
|
66
|
-
// Inline every file apart from node built-ins. We want vite/rollup to
|
|
67
|
-
// inline dependencies in the server build. This gets round runtime
|
|
68
|
-
// importing of "server-only" and other packages with poisoned imports.
|
|
69
|
-
//
|
|
70
|
-
// Files included in `noExternal` are files we want Vite to analyze
|
|
71
|
-
// As of vite 5.2 `true` here means "all except node built-ins"
|
|
72
|
-
// noExternal: true,
|
|
73
|
-
// TODO (RSC): Other frameworks build for RSC without `noExternal: true`.
|
|
74
|
-
// What are we missing here? When/why is that a better choice? I know
|
|
75
|
-
// we would have to explicitly add a bunch of packages to noExternal, if
|
|
76
|
-
// we wanted to go that route.
|
|
77
|
-
// noExternal: ['@tobbe.dev/rsc-test'],
|
|
78
|
-
// Can't inline prisma client (db calls fail at runtime) or react-dom
|
|
79
|
-
// (css pre-init failure)
|
|
80
|
-
// Server store has to be externalized, because it's a singleton (shared between FW and App)
|
|
81
|
-
external: [
|
|
82
|
-
"@prisma/client",
|
|
83
|
-
"@prisma/adapter-better-sqlite3",
|
|
84
|
-
"@prisma/fetch-engine",
|
|
85
|
-
"@prisma/internals",
|
|
86
|
-
"better-sqlite3",
|
|
87
|
-
"@cedarjs/auth-dbauth-api",
|
|
88
|
-
"@cedarjs/cookie-jar",
|
|
89
|
-
"@cedarjs/server-store",
|
|
90
|
-
"@simplewebauthn/server",
|
|
91
|
-
"graphql-scalars",
|
|
92
|
-
"minimatch",
|
|
93
|
-
"playwright",
|
|
94
|
-
"react-dom"
|
|
95
|
-
],
|
|
96
|
-
resolve: {
|
|
97
|
-
// These conditions are used in the plugin pipeline, and only affect non-externalized
|
|
98
|
-
// dependencies during the SSR build. Which because of `noExternal: true` means all
|
|
99
|
-
// dependencies apart from node built-ins.
|
|
100
|
-
// TODO (RSC): What's the difference between `conditions` and
|
|
101
|
-
// `externalConditions`? When is one used over the other?
|
|
102
|
-
// conditions: ['react-server'],
|
|
103
|
-
// externalConditions: ['react-server'],
|
|
104
|
-
},
|
|
105
|
-
optimizeDeps: {
|
|
106
|
-
// We need Vite to optimize these dependencies so that they are resolved
|
|
107
|
-
// with the correct conditions. And so that CJS modules work correctly.
|
|
108
|
-
// include: [
|
|
109
|
-
// 'react/**/*',
|
|
110
|
-
// 'react-dom/server',
|
|
111
|
-
// 'react-dom/server.edge',
|
|
112
|
-
// 'rehackt',
|
|
113
|
-
// 'react-server-dom-webpack/server',
|
|
114
|
-
// 'react-server-dom-webpack/client',
|
|
115
|
-
// '@apollo/client/cache/*',
|
|
116
|
-
// '@apollo/client/utilities/*',
|
|
117
|
-
// '@apollo/client/react/hooks/*',
|
|
118
|
-
// 'react-fast-compare',
|
|
119
|
-
// 'invariant',
|
|
120
|
-
// 'shallowequal',
|
|
121
|
-
// 'graphql/language/*',
|
|
122
|
-
// 'stacktracey',
|
|
123
|
-
// 'deepmerge',
|
|
124
|
-
// 'fast-glob',
|
|
125
|
-
// ],
|
|
126
|
-
}
|
|
127
|
-
},
|
|
128
|
-
resolve: {
|
|
129
|
-
// conditions: ['react-server'],
|
|
130
|
-
},
|
|
131
49
|
plugins: [
|
|
132
50
|
cjsInterop({
|
|
133
51
|
dependencies: [
|
|
@@ -136,186 +54,16 @@ async function createServer() {
|
|
|
136
54
|
"@cedarjs/prerender/*"
|
|
137
55
|
]
|
|
138
56
|
}),
|
|
139
|
-
rscEnabled && rscRoutesAutoLoader()
|
|
140
|
-
rscEnabled && rscSsrRouterImport()
|
|
57
|
+
rscEnabled && rscRoutesAutoLoader()
|
|
141
58
|
],
|
|
142
59
|
server: { middlewareMode: true },
|
|
143
60
|
logLevel: "info",
|
|
144
61
|
clearScreen: false,
|
|
145
62
|
appType: "custom"
|
|
146
63
|
});
|
|
147
|
-
globalThis.__cedarjs__vite_ssr_runtime = createServerModuleRunner(
|
|
148
|
-
viteSsrDevServer.environments.ssr
|
|
149
|
-
);
|
|
150
|
-
globalThis.__cedarjs__client_references = /* @__PURE__ */ new Set();
|
|
151
|
-
globalThis.__cedarjs__server_references = /* @__PURE__ */ new Set();
|
|
152
|
-
const viteRscServer = await createViteServer({
|
|
153
|
-
envFile: false,
|
|
154
|
-
define: {
|
|
155
|
-
"process.env.NODE_ENV": JSON.stringify(process.env.NODE_ENV)
|
|
156
|
-
},
|
|
157
|
-
ssr: {
|
|
158
|
-
// Inline every file apart from node built-ins. We want vite/rollup to
|
|
159
|
-
// inline dependencies in the server build. This gets round runtime
|
|
160
|
-
// importing of "server-only" and other packages with poisoned imports.
|
|
161
|
-
//
|
|
162
|
-
// Files included in `noExternal` are files we want Vite to analyze
|
|
163
|
-
// As of vite 5.2 `true` here means "all except node built-ins"
|
|
164
|
-
noExternal: true,
|
|
165
|
-
// TODO (RSC): Other frameworks build for RSC without `noExternal: true`.
|
|
166
|
-
// What are we missing here? When/why is that a better choice? I know
|
|
167
|
-
// we would have to explicitly add a bunch of packages to noExternal, if
|
|
168
|
-
// we wanted to go that route.
|
|
169
|
-
// noExternal: ['@tobbe.dev/rsc-test'],
|
|
170
|
-
// Can't inline prisma client (db calls fail at runtime) or react-dom
|
|
171
|
-
// (css pre-init failure)
|
|
172
|
-
// Server store has to be externalized, because it's a singleton (shared between FW and App)
|
|
173
|
-
external: [
|
|
174
|
-
"@prisma/client",
|
|
175
|
-
"@prisma/adapter-better-sqlite3",
|
|
176
|
-
"@prisma/fetch-engine",
|
|
177
|
-
"@prisma/internals",
|
|
178
|
-
"better-sqlite3",
|
|
179
|
-
"@cedarjs/auth-dbauth-api",
|
|
180
|
-
"@cedarjs/cookie-jar",
|
|
181
|
-
"@cedarjs/server-store",
|
|
182
|
-
"@cedarjs/structure",
|
|
183
|
-
"@simplewebauthn/server",
|
|
184
|
-
"graphql-scalars",
|
|
185
|
-
"minimatch",
|
|
186
|
-
"playwright",
|
|
187
|
-
"react-dom"
|
|
188
|
-
],
|
|
189
|
-
resolve: {
|
|
190
|
-
// These conditions are used in the plugin pipeline, and only affect non-externalized
|
|
191
|
-
// dependencies during the SSR build. Which because of `noExternal: true` means all
|
|
192
|
-
// dependencies apart from node built-ins.
|
|
193
|
-
// TODO (RSC): What's the difference between `conditions` and
|
|
194
|
-
// `externalConditions`? When is one used over the other?
|
|
195
|
-
// In Vite 6, we must include `defaultServerConditions` alongside
|
|
196
|
-
// `react-server` so that nested condition maps (e.g. the `node`
|
|
197
|
-
// sub-condition inside `react-server-dom-webpack/server`'s exports)
|
|
198
|
-
// can still be resolved. Without `node` (or another environment
|
|
199
|
-
// condition), the resolver throws "No known conditions for
|
|
200
|
-
// './server' specifier in 'react-server-dom-webpack' package".
|
|
201
|
-
conditions: ["react-server", ...defaultServerConditions],
|
|
202
|
-
externalConditions: ["react-server", ...defaultServerConditions]
|
|
203
|
-
},
|
|
204
|
-
optimizeDeps: {
|
|
205
|
-
// We need Vite to optimize these dependencies so that they are resolved
|
|
206
|
-
// with the correct conditions. And so that CJS modules work correctly.
|
|
207
|
-
include: [
|
|
208
|
-
"react/**/*",
|
|
209
|
-
"react-dom/server",
|
|
210
|
-
"react-dom/server.edge",
|
|
211
|
-
"react-server-dom-webpack/server",
|
|
212
|
-
"react-server-dom-webpack/server.edge",
|
|
213
|
-
"react-server-dom-webpack/client",
|
|
214
|
-
"react-server-dom-webpack/client.edge",
|
|
215
|
-
"@apollo/client",
|
|
216
|
-
"@apollo/client/cache",
|
|
217
|
-
"@apollo/client/link/context",
|
|
218
|
-
"@apollo/client/link/persisted-queries",
|
|
219
|
-
"@apollo/client/react",
|
|
220
|
-
"@apollo/client/utilities",
|
|
221
|
-
"rxjs",
|
|
222
|
-
"react-fast-compare",
|
|
223
|
-
"invariant",
|
|
224
|
-
"shallowequal",
|
|
225
|
-
"graphql/language/*",
|
|
226
|
-
"stacktracey",
|
|
227
|
-
"deepmerge",
|
|
228
|
-
"fast-glob",
|
|
229
|
-
"@whatwg-node/fetch",
|
|
230
|
-
"busboy",
|
|
231
|
-
"cookie"
|
|
232
|
-
],
|
|
233
|
-
// Ensure `util` resolves to Node's built-in module and not to
|
|
234
|
-
// Browserify's `node-util` polyfill (which lacks TextEncoder).
|
|
235
|
-
// The polyfill may be hoisted into node_modules by optional
|
|
236
|
-
// dependencies like `@cedarjs/storybook`.
|
|
237
|
-
exclude: ["util"]
|
|
238
|
-
}
|
|
239
|
-
},
|
|
240
|
-
resolve: {
|
|
241
|
-
// See comment above in ssr.resolve for why we include defaultServerConditions.
|
|
242
|
-
conditions: ["react-server", ...defaultServerConditions]
|
|
243
|
-
},
|
|
244
|
-
plugins: [
|
|
245
|
-
{
|
|
246
|
-
name: "rsc-record-and-tranform-use-client-plugin",
|
|
247
|
-
transform(code, id, _options) {
|
|
248
|
-
globalThis.__cedarjs__client_references?.delete(id);
|
|
249
|
-
if (!/^(["'])use client\1/.test(code)) {
|
|
250
|
-
return void 0;
|
|
251
|
-
}
|
|
252
|
-
console.log(
|
|
253
|
-
"rsc-record-and-transform-use-client-plugin: adding client reference",
|
|
254
|
-
id
|
|
255
|
-
);
|
|
256
|
-
globalThis.__cedarjs__client_references?.add(id);
|
|
257
|
-
const fns = code.matchAll(/export function (\w+)\(/g);
|
|
258
|
-
const consts = code.matchAll(/export const (\w+) = \(/g);
|
|
259
|
-
const names = [...fns, ...consts].map(([, name]) => name);
|
|
260
|
-
const result = [
|
|
261
|
-
`import { registerClientReference } from "react-server-dom-webpack/server.edge";`,
|
|
262
|
-
"",
|
|
263
|
-
...names.map((name) => {
|
|
264
|
-
return name === "default" ? `export default registerClientReference({}, "${id}", "${name}");` : `export const ${name} = registerClientReference({}, "${id}", "${name}");`;
|
|
265
|
-
})
|
|
266
|
-
].join("\n");
|
|
267
|
-
console.log("rsc-record-and-transform-use-client-plugin result");
|
|
268
|
-
console.log(
|
|
269
|
-
result.split("\n").map((line, i) => ` ${i + 1}: ${line}`).join("\n")
|
|
270
|
-
);
|
|
271
|
-
return { code: result, map: null };
|
|
272
|
-
}
|
|
273
|
-
},
|
|
274
|
-
rscTransformUseServerPlugin("", {}),
|
|
275
|
-
// The rscTransformUseClientPlugin maps paths like
|
|
276
|
-
// /Users/tobbe/.../rw-app/node_modules/@tobbe.dev/rsc-test/dist/rsc-test.es.js
|
|
277
|
-
// to
|
|
278
|
-
// /Users/tobbe/.../rw-app/web/dist/ssr/assets/rsc0.js
|
|
279
|
-
// That's why it needs the `clientEntryFiles` data
|
|
280
|
-
// (It does other things as well, but that's why it needs clientEntryFiles)
|
|
281
|
-
// rscTransformUseClientPlugin(clientEntryFiles),
|
|
282
|
-
// rscTransformUseServerPlugin(outDir, serverEntryFiles),
|
|
283
|
-
rscRoutesImports(),
|
|
284
|
-
{
|
|
285
|
-
name: "rsc-hot-update",
|
|
286
|
-
handleHotUpdate(ctx) {
|
|
287
|
-
console.log("rsc-hot-update ctx.modules", ctx.modules);
|
|
288
|
-
return [];
|
|
289
|
-
}
|
|
290
|
-
}
|
|
291
|
-
],
|
|
292
|
-
build: {
|
|
293
|
-
ssr: true
|
|
294
|
-
},
|
|
295
|
-
server: {
|
|
296
|
-
// We never call `viteRscServer.listen()`, so we should run this in
|
|
297
|
-
// middleware mode
|
|
298
|
-
middlewareMode: true,
|
|
299
|
-
// The hmr/fast-refresh websocket in this server collides with the one in
|
|
300
|
-
// the other Vite server. So we can either disable it or run it on a
|
|
301
|
-
// different port.
|
|
302
|
-
// TODO (RSC): Figure out if we should disable or just pick a different
|
|
303
|
-
// port
|
|
304
|
-
ws: false
|
|
305
|
-
// hmr: {
|
|
306
|
-
// port: 24679,
|
|
307
|
-
// },
|
|
308
|
-
},
|
|
309
|
-
appType: "custom",
|
|
310
|
-
// Using a unique cache dir here to not clash with our other vite server
|
|
311
|
-
cacheDir: "../node_modules/.vite-rsc"
|
|
312
|
-
});
|
|
313
|
-
globalThis.__cedarjs__vite_rsc_runtime = createServerModuleRunner(
|
|
314
|
-
viteRscServer.environments.ssr
|
|
315
|
-
);
|
|
316
64
|
const handleWithMiddleware = (route) => {
|
|
317
65
|
return createServerAdapter(async (req) => {
|
|
318
|
-
const middlewareRouter = await createMiddlewareRouter(
|
|
66
|
+
const middlewareRouter = await createMiddlewareRouter(vite);
|
|
319
67
|
const middleware = middlewareRouter.find(
|
|
320
68
|
req.method,
|
|
321
69
|
req.url
|
|
@@ -325,22 +73,19 @@ async function createServer() {
|
|
|
325
73
|
}
|
|
326
74
|
const [mwRes] = await invoke(req, middleware, {
|
|
327
75
|
route,
|
|
328
|
-
|
|
76
|
+
viteDevServer: vite
|
|
329
77
|
});
|
|
330
78
|
return mwRes.toResponse();
|
|
331
79
|
});
|
|
332
80
|
};
|
|
333
|
-
app.use(
|
|
81
|
+
app.use(vite.middlewares);
|
|
334
82
|
if (rscEnabled) {
|
|
335
|
-
|
|
336
|
-
const { createRscRequestHandler } = await globalThis.__cedarjs__vite_rsc_runtime.import(
|
|
337
|
-
new URL("./rsc/rscRequestHandler.js", import.meta.url).pathname
|
|
338
|
-
);
|
|
83
|
+
const { createRscRequestHandler } = await import("./rsc/rscRequestHandler.js");
|
|
339
84
|
app.use(
|
|
340
85
|
"/rw-rsc",
|
|
341
|
-
|
|
342
|
-
getMiddlewareRouter: async () => createMiddlewareRouter(
|
|
343
|
-
|
|
86
|
+
createRscRequestHandler({
|
|
87
|
+
getMiddlewareRouter: async () => createMiddlewareRouter(vite),
|
|
88
|
+
viteDevServer: vite
|
|
344
89
|
})
|
|
345
90
|
);
|
|
346
91
|
}
|
|
@@ -350,22 +95,18 @@ async function createServer() {
|
|
|
350
95
|
routes,
|
|
351
96
|
clientEntryPath: rwPaths.web.entryClient,
|
|
352
97
|
getStylesheetLinks: (route) => {
|
|
353
|
-
return getCssLinks({
|
|
354
|
-
rwPaths,
|
|
355
|
-
route,
|
|
356
|
-
viteSsrDevServer
|
|
357
|
-
});
|
|
98
|
+
return getCssLinks({ rwPaths, route, vite });
|
|
358
99
|
},
|
|
359
100
|
// Recreate middleware router on each request in dev
|
|
360
|
-
getMiddlewareRouter: async () => createMiddlewareRouter(
|
|
101
|
+
getMiddlewareRouter: async () => createMiddlewareRouter(vite)
|
|
361
102
|
},
|
|
362
|
-
|
|
103
|
+
vite
|
|
363
104
|
);
|
|
364
|
-
app.get("
|
|
365
|
-
app.post("
|
|
105
|
+
app.get("*", createServerAdapter(routeHandler));
|
|
106
|
+
app.post("*", handleWithMiddleware());
|
|
366
107
|
const port = getConfig().web.port;
|
|
367
108
|
console.log(`Started server on http://localhost:${port}`);
|
|
368
|
-
return
|
|
109
|
+
return app.listen(port);
|
|
369
110
|
}
|
|
370
111
|
let devApp = createServer();
|
|
371
112
|
process.stdin.on("data", async (data) => {
|
|
@@ -380,11 +121,11 @@ process.stdin.on("data", async (data) => {
|
|
|
380
121
|
function getCssLinks({
|
|
381
122
|
rwPaths,
|
|
382
123
|
route,
|
|
383
|
-
|
|
124
|
+
vite
|
|
384
125
|
}) {
|
|
385
126
|
const appAndRouteModules = componentsModules(
|
|
386
127
|
[rwPaths.web.app, route?.filePath].filter(Boolean),
|
|
387
|
-
|
|
128
|
+
vite
|
|
388
129
|
);
|
|
389
130
|
const collectedCss = collectCssPaths(appAndRouteModules);
|
|
390
131
|
const cssLinks = Array.from(collectedCss);
|
package/dist/index.d.ts
CHANGED
|
@@ -19,7 +19,6 @@ export { cedarRemoveFromBundle } from './plugins/vite-plugin-cedar-remove-from-b
|
|
|
19
19
|
export { cedarjsResolveCedarStyleImportsPlugin } from './plugins/vite-plugin-cedarjs-resolve-cedar-style-imports.js';
|
|
20
20
|
export { cedarjsJobPathInjectorPlugin } from './plugins/vite-plugin-cedarjs-job-path-injector.js';
|
|
21
21
|
export { cedarMockCellDataPlugin } from './plugins/vite-plugin-cedar-mock-cell-data.js';
|
|
22
|
-
export { cedarParsedScalarsPlugin } from './plugins/vite-plugin-cedar-parsed-scalars.js';
|
|
23
22
|
export { cedarMergedConfig } from './plugins/vite-plugin-merged-config.js';
|
|
24
23
|
export { cedarSwapApolloProvider } from './plugins/vite-plugin-swap-apollo-provider.js';
|
|
25
24
|
export { cedarUniversalDeployPlugin } from './plugins/vite-plugin-cedar-universal-deploy.js';
|
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,sBAAsB,CAAA;AACxD,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,MAAM,CAAA;
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,sBAAsB,CAAA;AACxD,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,MAAM,CAAA;AAoCxC,OAAO,EAAE,yBAAyB,EAAE,MAAM,iDAAiD,CAAA;AAC3F,OAAO,EAAE,sBAAsB,EAAE,MAAM,4CAA4C,CAAA;AACnF,OAAO,EAAE,oBAAoB,EAAE,MAAM,2CAA2C,CAAA;AAChF,OAAO,EAAE,kBAAkB,EAAE,MAAM,qCAAqC,CAAA;AACxE,OAAO,EAAE,uBAAuB,EAAE,MAAM,8CAA8C,CAAA;AACtF,OAAO,EAAE,gCAAgC,EAAE,MAAM,wDAAwD,CAAA;AACzG,OAAO,EAAE,uBAAuB,EAAE,MAAM,8CAA8C,CAAA;AACtF,OAAO,EACL,uBAAuB,EACvB,wBAAwB,GACzB,MAAM,+CAA+C,CAAA;AACtD,OAAO,EAAE,yBAAyB,EAAE,MAAM,gDAAgD,CAAA;AAC1F,OAAO,EAAE,kBAAkB,EAAE,MAAM,yCAAyC,CAAA;AAC5E,OAAO,EAAE,+BAA+B,EAAE,MAAM,uDAAuD,CAAA;AACvG,OAAO,EAAE,oBAAoB,EAAE,MAAM,2CAA2C,CAAA;AAChF,OAAO,EAAE,gBAAgB,EAAE,MAAM,8CAA8C,CAAA;AAC/E,OAAO,EAAE,4BAA4B,EAAE,MAAM,4DAA4D,CAAA;AACzG,OAAO,EAAE,2BAA2B,EAAE,MAAM,mDAAmD,CAAA;AAC/F,OAAO,EAAE,qBAAqB,EAAE,MAAM,mDAAmD,CAAA;AACzF,OAAO,EAAE,qCAAqC,EAAE,MAAM,8DAA8D,CAAA;AACpH,OAAO,EAAE,4BAA4B,EAAE,MAAM,oDAAoD,CAAA;AACjG,OAAO,EAAE,uBAAuB,EAAE,MAAM,+CAA+C,CAAA;AACvF,OAAO,EAAE,iBAAiB,EAAE,MAAM,wCAAwC,CAAA;AAC1E,OAAO,EAAE,uBAAuB,EAAE,MAAM,+CAA+C,CAAA;AACvF,OAAO,EAAE,0BAA0B,EAAE,MAAM,iDAAiD,CAAA;AAC5F,OAAO,EAAE,qBAAqB,EAAE,MAAM,oDAAoD,CAAA;AAE1F,KAAK,aAAa,GAAG;IACnB,IAAI,CAAC,EAAE,MAAM,GAAG,SAAS,CAAA;IACzB,KAAK,CAAC,EAAE,YAAY,GAAG,SAAS,CAAA;CACjC,CAAA;AAED;;GAEG;AACH,wBAAgB,KAAK,CAAC,EAAE,IAAI,EAAE,KAAK,EAAE,GAAE,aAAkB,GAAG,YAAY,EAAE,CA+CzE;AAED,8DAA8D;AAC9D,eAAe,KAAK,CAAA"}
|
package/dist/index.js
CHANGED
|
@@ -20,7 +20,6 @@ import { cedarDataUriShim } from "./plugins/vite-plugin-cedar-data-uri-shim.js";
|
|
|
20
20
|
import { cedarEntryInjectionPlugin } from "./plugins/vite-plugin-cedar-entry-injection.js";
|
|
21
21
|
import { cedarHtmlEnvPlugin } from "./plugins/vite-plugin-cedar-html-env.js";
|
|
22
22
|
import { cedarMockCellDataPlugin } from "./plugins/vite-plugin-cedar-mock-cell-data.js";
|
|
23
|
-
import { cedarParsedScalarsPlugin } from "./plugins/vite-plugin-cedar-parsed-scalars.js";
|
|
24
23
|
import { cedarRemoveDevFatalErrorPage } from "./plugins/vite-plugin-cedar-remove-dev-fatal-error-page.js";
|
|
25
24
|
import { cedarRemoveFromBundle } from "./plugins/vite-plugin-cedar-remove-from-bundle.js";
|
|
26
25
|
import { cedarRoutesAutoLoaderPlugin } from "./plugins/vite-plugin-cedar-routes-auto-loader.js";
|
|
@@ -50,7 +49,6 @@ import { cedarRemoveFromBundle as cedarRemoveFromBundle2 } from "./plugins/vite-
|
|
|
50
49
|
import { cedarjsResolveCedarStyleImportsPlugin as cedarjsResolveCedarStyleImportsPlugin2 } from "./plugins/vite-plugin-cedarjs-resolve-cedar-style-imports.js";
|
|
51
50
|
import { cedarjsJobPathInjectorPlugin } from "./plugins/vite-plugin-cedarjs-job-path-injector.js";
|
|
52
51
|
import { cedarMockCellDataPlugin as cedarMockCellDataPlugin2 } from "./plugins/vite-plugin-cedar-mock-cell-data.js";
|
|
53
|
-
import { cedarParsedScalarsPlugin as cedarParsedScalarsPlugin2 } from "./plugins/vite-plugin-cedar-parsed-scalars.js";
|
|
54
52
|
import { cedarMergedConfig as cedarMergedConfig2 } from "./plugins/vite-plugin-merged-config.js";
|
|
55
53
|
import { cedarSwapApolloProvider as cedarSwapApolloProvider2 } from "./plugins/vite-plugin-swap-apollo-provider.js";
|
|
56
54
|
import { cedarUniversalDeployPlugin } from "./plugins/vite-plugin-cedar-universal-deploy.js";
|
|
@@ -81,7 +79,6 @@ function cedar({ mode, babel } = {}) {
|
|
|
81
79
|
cedarMergedConfig(),
|
|
82
80
|
cedarjsResolveCedarStyleImportsPlugin(),
|
|
83
81
|
cedarSwapApolloProvider(),
|
|
84
|
-
cedarParsedScalarsPlugin(),
|
|
85
82
|
cedarCellTransform(),
|
|
86
83
|
cedarRemoveFromBundle(),
|
|
87
84
|
cedarRemoveDevFatalErrorPage(),
|
|
@@ -110,7 +107,6 @@ export {
|
|
|
110
107
|
cedarMergedConfig2 as cedarMergedConfig,
|
|
111
108
|
cedarMockCellDataPlugin2 as cedarMockCellDataPlugin,
|
|
112
109
|
cedarOtelWrappingPlugin,
|
|
113
|
-
cedarParsedScalarsPlugin2 as cedarParsedScalarsPlugin,
|
|
114
110
|
cedarRemoveDevFatalErrorPage2 as cedarRemoveDevFatalErrorPage,
|
|
115
111
|
cedarRemoveFromBundle2 as cedarRemoveFromBundle,
|
|
116
112
|
cedarRoutesAutoLoaderPlugin2 as cedarRoutesAutoLoaderPlugin,
|
|
@@ -65,15 +65,6 @@ function registerFwShims() {
|
|
|
65
65
|
globalThis.__rw_module_cache__ ||= /* @__PURE__ */ new Map();
|
|
66
66
|
globalThis.__webpack_chunk_load__ ||= async (id) => {
|
|
67
67
|
console.log("registerFwShims chunk load id", id);
|
|
68
|
-
if (globalThis.__cedarjs__vite_ssr_runtime) {
|
|
69
|
-
return globalThis.__cedarjs__vite_ssr_runtime?.import(id).then((mod) => {
|
|
70
|
-
console.log("registerFwShims chunk load mod", mod);
|
|
71
|
-
if (mod.default && typeof mod.default === "object") {
|
|
72
|
-
return globalThis.__rw_module_cache__.set(id, mod.default);
|
|
73
|
-
}
|
|
74
|
-
return globalThis.__rw_module_cache__.set(id, mod);
|
|
75
|
-
});
|
|
76
|
-
}
|
|
77
68
|
return import(id).then((mod) => {
|
|
78
69
|
console.log("registerFwShims chunk load mod", mod);
|
|
79
70
|
if (mod.default && typeof mod.default === "object") {
|
|
@@ -1,6 +1,3 @@
|
|
|
1
1
|
import type { Middleware, MiddlewareClass } from '@cedarjs/web/dist/server/middleware';
|
|
2
|
-
export type MiddlewareReg = ([
|
|
3
|
-
Middleware | MiddlewareClass,
|
|
4
|
-
string
|
|
5
|
-
] | Middleware | MiddlewareClass)[];
|
|
2
|
+
export type MiddlewareReg = ([Middleware | MiddlewareClass, string] | Middleware | MiddlewareClass)[];
|
|
6
3
|
//# sourceMappingURL=types.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src/middleware/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,UAAU,EACV,eAAe,EAChB,MAAM,qCAAqC,CAAA;AAG5C,MAAM,MAAM,aAAa,GAAG,
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src/middleware/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,UAAU,EACV,eAAe,EAChB,MAAM,qCAAqC,CAAA;AAG5C,MAAM,MAAM,aAAa,GAAG,CACxB,CAAC,UAAU,GAAG,eAAe,EAAE,MAAM,CAAC,GACtC,UAAU,GACV,eAAe,CAClB,EAAE,CAAA"}
|
|
@@ -16,8 +16,7 @@ import type { Plugin } from 'vite';
|
|
|
16
16
|
* export const QUERY = gql`...`
|
|
17
17
|
* export const Loading = () => <div>Loading...</div>
|
|
18
18
|
* export const Success = ({ data }) => <div>{data}</div>
|
|
19
|
-
*
|
|
20
|
-
* export default MyCell
|
|
19
|
+
* export default createCell({ QUERY, Loading, Success, displayName: 'MyCell' })
|
|
21
20
|
* ```
|
|
22
21
|
*/
|
|
23
22
|
export declare function cedarCellTransform(): Plugin;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"vite-plugin-cedar-cell.d.ts","sourceRoot":"","sources":["../../src/plugins/vite-plugin-cedar-cell.ts"],"names":[],"mappings":"AAMA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,MAAM,CAAA;AAqBlC
|
|
1
|
+
{"version":3,"file":"vite-plugin-cedar-cell.d.ts","sourceRoot":"","sources":["../../src/plugins/vite-plugin-cedar-cell.ts"],"names":[],"mappings":"AAMA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,MAAM,CAAA;AAqBlC;;;;;;;;;;;;;;;;;;;GAmBG;AACH,wBAAgB,kBAAkB,IAAI,MAAM,CAsK3C"}
|
|
@@ -23,7 +23,6 @@ function cedarCellTransform() {
|
|
|
23
23
|
if (!id.match(/Cell\.[jt]sx?$/)) {
|
|
24
24
|
return null;
|
|
25
25
|
}
|
|
26
|
-
const cellComponentName = parsePath(id).name;
|
|
27
26
|
try {
|
|
28
27
|
const ast = parse(code, {
|
|
29
28
|
sourceType: "module",
|
|
@@ -112,38 +111,20 @@ function cedarCellTransform() {
|
|
|
112
111
|
computed: false
|
|
113
112
|
}
|
|
114
113
|
];
|
|
115
|
-
const cellVariableDeclaration = {
|
|
116
|
-
type: "VariableDeclaration",
|
|
117
|
-
kind: "const",
|
|
118
|
-
declarations: [
|
|
119
|
-
{
|
|
120
|
-
type: "VariableDeclarator",
|
|
121
|
-
id: {
|
|
122
|
-
type: "Identifier",
|
|
123
|
-
name: cellComponentName
|
|
124
|
-
},
|
|
125
|
-
init: {
|
|
126
|
-
type: "CallExpression",
|
|
127
|
-
callee: {
|
|
128
|
-
type: "Identifier",
|
|
129
|
-
name: createCellHookName
|
|
130
|
-
},
|
|
131
|
-
arguments: [
|
|
132
|
-
{
|
|
133
|
-
type: "ObjectExpression",
|
|
134
|
-
properties: objectProperties
|
|
135
|
-
}
|
|
136
|
-
]
|
|
137
|
-
}
|
|
138
|
-
}
|
|
139
|
-
]
|
|
140
|
-
};
|
|
141
|
-
path.node.body.push(cellVariableDeclaration);
|
|
142
114
|
const exportDefaultDeclaration = {
|
|
143
115
|
type: "ExportDefaultDeclaration",
|
|
144
116
|
declaration: {
|
|
145
|
-
type: "
|
|
146
|
-
|
|
117
|
+
type: "CallExpression",
|
|
118
|
+
callee: {
|
|
119
|
+
type: "Identifier",
|
|
120
|
+
name: createCellHookName
|
|
121
|
+
},
|
|
122
|
+
arguments: [
|
|
123
|
+
{
|
|
124
|
+
type: "ObjectExpression",
|
|
125
|
+
properties: objectProperties
|
|
126
|
+
}
|
|
127
|
+
]
|
|
147
128
|
}
|
|
148
129
|
};
|
|
149
130
|
path.node.body.push(exportDefaultDeclaration);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"vite-plugin-cedar-mock-cell-data.d.ts","sourceRoot":"","sources":["../../src/plugins/vite-plugin-cedar-mock-cell-data.ts"],"names":[],"mappings":"AAWA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,MAAM,CAAA;AAMlC;;;;;;;;;;;;GAYG;AACH,wBAAgB,uBAAuB,IAAI,MAAM,
|
|
1
|
+
{"version":3,"file":"vite-plugin-cedar-mock-cell-data.d.ts","sourceRoot":"","sources":["../../src/plugins/vite-plugin-cedar-mock-cell-data.ts"],"names":[],"mappings":"AAWA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,MAAM,CAAA;AAMlC;;;;;;;;;;;;GAYG;AACH,wBAAgB,uBAAuB,IAAI,MAAM,CA2KhD;AAcD,eAAO,MAAM,eAAe,GAAI,GAAG,MAAM;;;;;;CAoFxC,CAAA;AAgCD,UAAU,YAAY;IACpB,IAAI,EAAE,MAAM,CAAA;IACZ,IAAI,EAAE,WAAW,GAAG,UAAU,GAAG,UAAU,GAAG,OAAO,CAAA;CACtD"}
|
|
@@ -25,7 +25,9 @@ import type { Plugin } from 'vite';
|
|
|
25
25
|
* This replaces `babel-plugin-handler-als-wrapping` for Vite builds.
|
|
26
26
|
* The babel plugin is still used for Jest and prerender.
|
|
27
27
|
*/
|
|
28
|
-
export declare function handlerAlsWrappingPlugin(
|
|
28
|
+
export declare function handlerAlsWrappingPlugin({ projectIsEsm, }?: {
|
|
29
|
+
projectIsEsm?: boolean;
|
|
30
|
+
}): Plugin;
|
|
29
31
|
/**
|
|
30
32
|
* Wraps the `handler` export of an API function file with an async context
|
|
31
33
|
* store guard. Returns the transformed code, or `null` if the file does not
|
|
@@ -36,5 +38,7 @@ export declare function handlerAlsWrappingPlugin(): Plugin;
|
|
|
36
38
|
* function so it can be applied from build pipelines that don't go through
|
|
37
39
|
* Vite's plugin pipeline (e.g. the legacy esbuild API build).
|
|
38
40
|
*/
|
|
39
|
-
export declare function applyHandlerAlsWrapping(code: string
|
|
41
|
+
export declare function applyHandlerAlsWrapping(code: string, { projectIsEsm }?: {
|
|
42
|
+
projectIsEsm?: boolean;
|
|
43
|
+
}): string | null;
|
|
40
44
|
//# sourceMappingURL=vite-plugin-handler-als-wrapping.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"vite-plugin-handler-als-wrapping.d.ts","sourceRoot":"","sources":["../../src/plugins/vite-plugin-handler-als-wrapping.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,MAAM,CAAA;AAKlC;;;;;;;;;;;;;;;;;;;;;;;;;GAyBG;AACH,wBAAgB,wBAAwB,
|
|
1
|
+
{"version":3,"file":"vite-plugin-handler-als-wrapping.d.ts","sourceRoot":"","sources":["../../src/plugins/vite-plugin-handler-als-wrapping.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,MAAM,CAAA;AAKlC;;;;;;;;;;;;;;;;;;;;;;;;;GAyBG;AACH,wBAAgB,wBAAwB,CAAC,EACvC,YAAoB,GACrB,GAAE;IACD,YAAY,CAAC,EAAE,OAAO,CAAA;CAClB,GAAG,MAAM,CAuBd;AAED;;;;;;;;;GASG;AACH,wBAAgB,uBAAuB,CACrC,IAAI,EAAE,MAAM,EACZ,EAAE,YAAoB,EAAE,GAAE;IAAE,YAAY,CAAC,EAAE,OAAO,CAAA;CAAO,GACxD,MAAM,GAAG,IAAI,CAsDf"}
|
|
@@ -1,7 +1,9 @@
|
|
|
1
1
|
import path from "node:path";
|
|
2
2
|
import { normalizePath } from "vite";
|
|
3
3
|
import { getPaths } from "@cedarjs/project-config";
|
|
4
|
-
function handlerAlsWrappingPlugin(
|
|
4
|
+
function handlerAlsWrappingPlugin({
|
|
5
|
+
projectIsEsm = false
|
|
6
|
+
} = {}) {
|
|
5
7
|
return {
|
|
6
8
|
name: "handler-als-wrapping",
|
|
7
9
|
transform(code, id) {
|
|
@@ -15,12 +17,12 @@ function handlerAlsWrappingPlugin() {
|
|
|
15
17
|
if (!normalizePath(id).startsWith(functionsDir + "/")) {
|
|
16
18
|
return null;
|
|
17
19
|
}
|
|
18
|
-
const wrapped = applyHandlerAlsWrapping(code);
|
|
20
|
+
const wrapped = applyHandlerAlsWrapping(code, { projectIsEsm });
|
|
19
21
|
return wrapped ? { code: wrapped, map: null } : null;
|
|
20
22
|
}
|
|
21
23
|
};
|
|
22
24
|
}
|
|
23
|
-
function applyHandlerAlsWrapping(code) {
|
|
25
|
+
function applyHandlerAlsWrapping(code, { projectIsEsm = false } = {}) {
|
|
24
26
|
const handlerRe = /^export\s+(?:const|let|var)\s+handler(?:[^=]|=>)*?=(?![>=])/m;
|
|
25
27
|
const handlerMatch = handlerRe.exec(code);
|
|
26
28
|
if (!handlerMatch) {
|
|
@@ -28,7 +30,8 @@ function applyHandlerAlsWrapping(code) {
|
|
|
28
30
|
}
|
|
29
31
|
const afterEquals = code.slice(handlerMatch.index + handlerMatch[0].length).trimStart();
|
|
30
32
|
const isAsync = /^async(?:\s*[\(\*]|\s+function)/.test(afterEquals);
|
|
31
|
-
const
|
|
33
|
+
const storePath = projectIsEsm ? "@cedarjs/context/dist/store.js" : "@cedarjs/context/dist/store";
|
|
34
|
+
const importStatement = `import { getAsyncStoreInstance as __cedar_getAsyncStoreInstance } from '${storePath}'
|
|
32
35
|
`;
|
|
33
36
|
const handlerStart = handlerMatch.index;
|
|
34
37
|
const before = code.slice(0, handlerStart);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"vite-plugin-rsc-ssr-router-import.d.ts","sourceRoot":"","sources":["../../src/plugins/vite-plugin-rsc-ssr-router-import.ts"],"names":[],"mappings":"AAQA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,MAAM,CAAA;AAKlC;;;GAGG;AACH,wBAAgB,kBAAkB,IAAI,MAAM,
|
|
1
|
+
{"version":3,"file":"vite-plugin-rsc-ssr-router-import.d.ts","sourceRoot":"","sources":["../../src/plugins/vite-plugin-rsc-ssr-router-import.ts"],"names":[],"mappings":"AAQA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,MAAM,CAAA;AAKlC;;;GAGG;AACH,wBAAgB,kBAAkB,IAAI,MAAM,CAqC3C"}
|
|
@@ -11,8 +11,8 @@ function rscSsrRouterImport() {
|
|
|
11
11
|
const routesFileId = normalizePath(getPaths().web.routes);
|
|
12
12
|
return {
|
|
13
13
|
name: "rsc-ssr-router-import",
|
|
14
|
-
transform: async function(code, id
|
|
15
|
-
if (
|
|
14
|
+
transform: async function(code, id) {
|
|
15
|
+
if (id !== routesFileId) {
|
|
16
16
|
return null;
|
|
17
17
|
}
|
|
18
18
|
const ext = path.extname(id);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"vite-plugin-rsc-transform-server.d.ts","sourceRoot":"","sources":["../../src/plugins/vite-plugin-rsc-transform-server.ts"],"names":[],"mappings":"AAKA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,MAAM,CAAA;AAElC,wBAAgB,2BAA2B,CACzC,MAAM,EAAE,MAAM,EACd,gBAAgB,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,GACvC,MAAM,
|
|
1
|
+
{"version":3,"file":"vite-plugin-rsc-transform-server.d.ts","sourceRoot":"","sources":["../../src/plugins/vite-plugin-rsc-transform-server.ts"],"names":[],"mappings":"AAKA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,MAAM,CAAA;AAElC,wBAAgB,2BAA2B,CACzC,MAAM,EAAE,MAAM,EACd,gBAAgB,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,GACvC,MAAM,CA8GR"}
|
|
@@ -8,10 +8,6 @@ function rscTransformUseServerPlugin(outDir, serverEntryFiles) {
|
|
|
8
8
|
if (!code.includes("use server")) {
|
|
9
9
|
return code;
|
|
10
10
|
}
|
|
11
|
-
if (id.includes("node_modules/.vite") || id.includes("/react-server-dom-webpack/") || id.includes("/react-server-dom-webpack.server")) {
|
|
12
|
-
console.log("vite-plugin-rsc-transform-server.ts: Skipping", id);
|
|
13
|
-
return code;
|
|
14
|
-
}
|
|
15
11
|
let mod;
|
|
16
12
|
const isTypescript = id.endsWith(".ts") || id.endsWith(".tsx");
|
|
17
13
|
try {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"rscRenderer.d.ts","sourceRoot":"","sources":["../../src/rsc/rscRenderer.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,iBAAiB,CAAA;
|
|
1
|
+
{"version":3,"file":"rscRenderer.d.ts","sourceRoot":"","sources":["../../src/rsc/rscRenderer.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,iBAAiB,CAAA;AAWrD,MAAM,MAAM,WAAW,GAAG;IACxB,KAAK,CAAC,EAAE,MAAM,GAAG,SAAS,CAAA;IAC1B,KAAK,CAAC,EAAE,MAAM,GAAG,SAAS,CAAA;IAC1B,IAAI,CAAC,EAAE,OAAO,EAAE,GAAG,SAAS,CAAA;CAC7B,CAAA;AAID,wBAAgB,iBAAiB,CAAC,KAAK,EAAE,WAAW,GAAG,OAAO,CAAC,cAAc,CAAC,CAE7E;AAyBD,wBAAsB,gBAAgB,IAAI,OAAO,CAAC,IAAI,CAAC,CA2BtD"}
|