@cedarjs/vite 5.0.0 → 6.0.0-canary.2615
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/apiDevMiddleware.d.ts.map +1 -1
- package/dist/apiDevMiddleware.js +8 -1
- package/dist/buildApp.d.ts.map +1 -1
- package/dist/buildApp.js +6 -2
- package/dist/bundled/react-server-dom-webpack.server.js +1224 -28521
- package/dist/cjs/apiDevMiddleware.js +8 -1
- package/dist/cjs/buildApp.js +6 -2
- package/dist/cjs/devFeServer.js +268 -15
- package/dist/cjs/index.js +19 -13
- package/dist/cjs/lib/registerFwGlobalsAndShims.js +9 -0
- package/dist/cjs/plugins/vite-plugin-cedar-data-uri-shim.js +67 -0
- package/dist/cjs/plugins/vite-plugin-cedar-gqlorm-inject.js +106 -0
- package/dist/cjs/plugins/vite-plugin-cedar-graphql-options-extract.js +113 -0
- package/dist/cjs/plugins/vite-plugin-cedar-universal-deploy.js +1 -1
- package/dist/cjs/plugins/{vite-plugin-cedar-context-wrapping.js → vite-plugin-handler-als-wrapping.js} +11 -11
- package/dist/cjs/plugins/vite-plugin-rsc-ssr-router-import.js +2 -2
- package/dist/cjs/plugins/vite-plugin-rsc-transform-server.js +4 -0
- package/dist/cjs/rsc/rscRenderer.js +23 -9
- package/dist/cjs/rsc/rscRequestHandler.js +6 -6
- package/dist/cjs/rsc/rscWebSocketServer.js +56 -0
- package/dist/cjs/rsc/utils.js +56 -0
- package/dist/cjs/runFeServer.js +3 -22
- package/dist/cjs/streaming/createReactStreamingHandler.js +13 -10
- package/dist/cjs/streaming/streamHelpers.js +49 -32
- package/dist/cjs/streaming/triggerRouteHooks.js +3 -3
- package/dist/devFeServer.js +272 -16
- package/dist/index.d.ts +5 -3
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +13 -9
- package/dist/lib/registerFwGlobalsAndShims.js +9 -0
- package/dist/plugins/vite-plugin-cedar-data-uri-shim.d.ts +3 -0
- package/dist/plugins/vite-plugin-cedar-data-uri-shim.d.ts.map +1 -0
- package/dist/plugins/vite-plugin-cedar-data-uri-shim.js +43 -0
- package/dist/plugins/vite-plugin-cedar-gqlorm-inject.d.ts +29 -0
- package/dist/plugins/vite-plugin-cedar-gqlorm-inject.d.ts.map +1 -0
- package/dist/plugins/vite-plugin-cedar-gqlorm-inject.js +76 -0
- package/dist/plugins/vite-plugin-cedar-graphql-options-extract.d.ts +38 -0
- package/dist/plugins/vite-plugin-cedar-graphql-options-extract.d.ts.map +1 -0
- package/dist/plugins/vite-plugin-cedar-graphql-options-extract.js +88 -0
- package/dist/plugins/vite-plugin-cedar-universal-deploy.js +1 -1
- package/dist/plugins/{vite-plugin-cedar-context-wrapping.d.ts → vite-plugin-handler-als-wrapping.d.ts} +5 -5
- package/dist/plugins/vite-plugin-handler-als-wrapping.d.ts.map +1 -0
- package/dist/plugins/{vite-plugin-cedar-context-wrapping.js → vite-plugin-handler-als-wrapping.js} +6 -6
- 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 +4 -0
- package/dist/rsc/rscRenderer.d.ts.map +1 -1
- package/dist/rsc/rscRenderer.js +19 -5
- 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/rsc/rscWebSocketServer.d.ts +2 -0
- package/dist/rsc/rscWebSocketServer.d.ts.map +1 -0
- package/dist/rsc/rscWebSocketServer.js +22 -0
- package/dist/rsc/utils.d.ts +10 -0
- package/dist/rsc/utils.d.ts.map +1 -0
- package/dist/rsc/utils.js +21 -0
- package/dist/runFeServer.js +2 -21
- package/dist/streaming/createReactStreamingHandler.d.ts +1 -1
- package/dist/streaming/createReactStreamingHandler.d.ts.map +1 -1
- package/dist/streaming/createReactStreamingHandler.js +13 -10
- package/dist/streaming/streamHelpers.d.ts +2 -2
- package/dist/streaming/streamHelpers.d.ts.map +1 -1
- package/dist/streaming/streamHelpers.js +49 -31
- 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 +18 -19
- package/dist/cjs/plugins/vite-plugin-cedar-node-polyfills.js +0 -43
- package/dist/plugins/vite-plugin-cedar-context-wrapping.d.ts.map +0 -1
- package/dist/plugins/vite-plugin-cedar-node-polyfills.d.ts +0 -3
- package/dist/plugins/vite-plugin-cedar-node-polyfills.d.ts.map +0 -1
- package/dist/plugins/vite-plugin-cedar-node-polyfills.js +0 -19
|
@@ -28,7 +28,6 @@ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__ge
|
|
|
28
28
|
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
29
29
|
var streamHelpers_exports = {};
|
|
30
30
|
__export(streamHelpers_exports, {
|
|
31
|
-
importModule: () => importModule,
|
|
32
31
|
reactRenderToStreamResponse: () => reactRenderToStreamResponse
|
|
33
32
|
});
|
|
34
33
|
module.exports = __toCommonJS(streamHelpers_exports);
|
|
@@ -62,7 +61,7 @@ globalThis.__webpack_require__ ||= (id) => {
|
|
|
62
61
|
return globalThis.__rw_module_cache__.get(id)
|
|
63
62
|
};
|
|
64
63
|
`;
|
|
65
|
-
async function reactRenderToStreamResponse(mwRes, renderOptions, streamOptions) {
|
|
64
|
+
async function reactRenderToStreamResponse(mwRes, renderOptions, streamOptions, viteDevServer) {
|
|
66
65
|
const { waitForAllReady = false } = streamOptions;
|
|
67
66
|
const {
|
|
68
67
|
ServerEntry,
|
|
@@ -84,13 +83,13 @@ async function reactRenderToStreamResponse(mwRes, renderOptions, streamOptions)
|
|
|
84
83
|
meta: metaTags
|
|
85
84
|
});
|
|
86
85
|
const rscEnabled = (0, import_project_config.getConfig)().experimental?.rsc?.enabled;
|
|
87
|
-
const { createElement } = rscEnabled ? await importModule("__cedarjs__react") : await import("react");
|
|
86
|
+
const { createElement } = rscEnabled ? await importModule("__cedarjs__react", !!viteDevServer) : await import("react");
|
|
88
87
|
const {
|
|
89
88
|
createInjector,
|
|
90
89
|
ServerHtmlProvider,
|
|
91
90
|
ServerInjectedHtml
|
|
92
|
-
} = rscEnabled ? await importModule("__cedarjs__server_inject") : await import("@cedarjs/web/serverInject");
|
|
93
|
-
const { renderToString } = rscEnabled ? await importModule("rd-server") : await import("react-dom/server");
|
|
91
|
+
} = rscEnabled ? await importModule("__cedarjs__server_inject", !!viteDevServer) : await import("@cedarjs/web/serverInject");
|
|
92
|
+
const { renderToString } = rscEnabled ? await importModule("rd-server", !!viteDevServer) : await import("react-dom/server");
|
|
94
93
|
const { injectionState, injectToPage } = createInjector();
|
|
95
94
|
const bufferTransform = (0, import_bufferedTransform.createBufferedTransformStream)();
|
|
96
95
|
const serverInjectionTransform = (0, import_serverInjectionTransform.createServerInjectionTransform)({
|
|
@@ -105,8 +104,8 @@ async function reactRenderToStreamResponse(mwRes, renderOptions, streamOptions)
|
|
|
105
104
|
controller.abort();
|
|
106
105
|
}, 1e4);
|
|
107
106
|
const timeoutTransform = (0, import_cancelTimeoutTransform.createTimeoutTransform)(timeoutHandle);
|
|
108
|
-
const { ServerAuthProvider } = rscEnabled ? await importModule("__cedarjs__server_auth_provider") : await import("@cedarjs/auth/dist/AuthProvider/ServerAuthProvider.js");
|
|
109
|
-
const { LocationProvider } = rscEnabled ? await importModule("__cedarjs__location") : await import("@cedarjs/router/location");
|
|
107
|
+
const { ServerAuthProvider } = rscEnabled ? await importModule("__cedarjs__server_auth_provider", !!viteDevServer) : await import("@cedarjs/auth/dist/AuthProvider/ServerAuthProvider.js");
|
|
108
|
+
const { LocationProvider } = rscEnabled ? await importModule("__cedarjs__location", !!viteDevServer) : await import("@cedarjs/router/location");
|
|
110
109
|
const renderRoot = (url) => {
|
|
111
110
|
return createElement(
|
|
112
111
|
ServerAuthProvider,
|
|
@@ -138,7 +137,7 @@ async function reactRenderToStreamResponse(mwRes, renderOptions, streamOptions)
|
|
|
138
137
|
),
|
|
139
138
|
bootstrapModules: jsBundles
|
|
140
139
|
};
|
|
141
|
-
const { renderToReadableStream } = rscEnabled ? await importModule("rd-server") : await import("react-dom/server.edge");
|
|
140
|
+
const { renderToReadableStream } = rscEnabled ? await importModule("rd-server", !!viteDevServer) : await import("react-dom/server.edge");
|
|
142
141
|
try {
|
|
143
142
|
let didErrorOutsideShell = false;
|
|
144
143
|
const renderToStreamOptions = {
|
|
@@ -197,34 +196,52 @@ function applyStreamTransforms(reactStream, transformsToApply) {
|
|
|
197
196
|
}
|
|
198
197
|
return outputStream;
|
|
199
198
|
}
|
|
200
|
-
async function importModule(mod) {
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
199
|
+
async function importModule(mod, isDev) {
|
|
200
|
+
if (isDev) {
|
|
201
|
+
if (mod === "rd-server") {
|
|
202
|
+
const loadedMod = await import("react-dom/server.edge");
|
|
203
|
+
return loadedMod.default;
|
|
204
|
+
} else if (mod === "__cedarjs__react") {
|
|
205
|
+
const loadedMod = await import("react");
|
|
206
|
+
return loadedMod.default;
|
|
207
|
+
} else if (mod === "__cedarjs__location") {
|
|
208
|
+
const loadedMod = await import("@cedarjs/router/location");
|
|
209
|
+
return loadedMod;
|
|
210
|
+
} else if (mod === "__cedarjs__server_auth_provider") {
|
|
211
|
+
const loadedMod = await import("@cedarjs/auth/dist/AuthProvider/ServerAuthProvider.js");
|
|
212
|
+
return loadedMod;
|
|
213
|
+
} else if (mod === "__cedarjs__server_inject") {
|
|
214
|
+
const loadedMod = await import("@cedarjs/web/serverInject");
|
|
215
|
+
return loadedMod;
|
|
216
|
+
}
|
|
217
|
+
} else {
|
|
218
|
+
const distSsr = (0, import_project_config.getPaths)().web.distSsr;
|
|
219
|
+
const rdServerPath = (0, import_utils.makeFilePath)(import_node_path.default.join(distSsr, "rd-server.mjs"));
|
|
220
|
+
const reactPath = (0, import_utils.makeFilePath)(import_node_path.default.join(distSsr, "__cedarjs__react.mjs"));
|
|
221
|
+
const locationPath = (0, import_utils.makeFilePath)(
|
|
222
|
+
import_node_path.default.join(distSsr, "__cedarjs__location.mjs")
|
|
223
|
+
);
|
|
224
|
+
const serverAuthProviderPath = (0, import_utils.makeFilePath)(
|
|
225
|
+
import_node_path.default.join(distSsr, "__cedarjs__server_auth_provider.mjs")
|
|
226
|
+
);
|
|
227
|
+
const serverInjectPath = (0, import_utils.makeFilePath)(
|
|
228
|
+
import_node_path.default.join(distSsr, "__cedarjs__server_inject.mjs")
|
|
229
|
+
);
|
|
230
|
+
if (mod === "rd-server") {
|
|
231
|
+
return (await import(rdServerPath)).default;
|
|
232
|
+
} else if (mod === "__cedarjs__react") {
|
|
233
|
+
return (await import(reactPath)).default;
|
|
234
|
+
} else if (mod === "__cedarjs__location") {
|
|
235
|
+
return await import(locationPath);
|
|
236
|
+
} else if (mod === "__cedarjs__server_auth_provider") {
|
|
237
|
+
return await import(serverAuthProviderPath);
|
|
238
|
+
} else if (mod === "__cedarjs__server_inject") {
|
|
239
|
+
return await import(serverInjectPath);
|
|
240
|
+
}
|
|
223
241
|
}
|
|
224
242
|
throw new Error("Unknown module " + mod);
|
|
225
243
|
}
|
|
226
244
|
// Annotate the CommonJS export names for ESM import in node:
|
|
227
245
|
0 && (module.exports = {
|
|
228
|
-
importModule,
|
|
229
246
|
reactRenderToStreamResponse
|
|
230
247
|
});
|
|
@@ -55,11 +55,11 @@ const defaultRouteHookOutput = {
|
|
|
55
55
|
const loadAndRunRouteHooks = async ({
|
|
56
56
|
paths = [],
|
|
57
57
|
reqMeta,
|
|
58
|
-
|
|
58
|
+
viteSsrDevServer,
|
|
59
59
|
previousOutput = defaultRouteHookOutput
|
|
60
60
|
}) => {
|
|
61
61
|
const loadModule = async (path) => {
|
|
62
|
-
return
|
|
62
|
+
return viteSsrDevServer ? viteSsrDevServer.ssrLoadModule(path) : import(path);
|
|
63
63
|
};
|
|
64
64
|
let currentRouteHooks;
|
|
65
65
|
let rhOutput = defaultRouteHookOutput;
|
|
@@ -79,7 +79,7 @@ const loadAndRunRouteHooks = async ({
|
|
|
79
79
|
paths,
|
|
80
80
|
reqMeta,
|
|
81
81
|
previousOutput: rhOutput,
|
|
82
|
-
|
|
82
|
+
viteSsrDevServer
|
|
83
83
|
});
|
|
84
84
|
} else {
|
|
85
85
|
return rhOutput;
|
package/dist/devFeServer.js
CHANGED
|
@@ -1,7 +1,12 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
+
import http from "node:http";
|
|
2
3
|
import { createServerAdapter } from "@whatwg-node/server";
|
|
3
4
|
import express from "express";
|
|
4
|
-
import {
|
|
5
|
+
import {
|
|
6
|
+
createServer as createViteServer,
|
|
7
|
+
createServerModuleRunner,
|
|
8
|
+
defaultServerConditions
|
|
9
|
+
} from "vite";
|
|
5
10
|
import { cjsInterop } from "vite-plugin-cjs-interop";
|
|
6
11
|
import { getProjectRoutes } from "@cedarjs/internal/dist/routes.js";
|
|
7
12
|
import { getConfig, getPaths } from "@cedarjs/project-config";
|
|
@@ -10,6 +15,10 @@ import { registerFwGlobalsAndShims } from "./lib/registerFwGlobalsAndShims.js";
|
|
|
10
15
|
import { invoke } from "./middleware/invokeMiddleware.js";
|
|
11
16
|
import { createMiddlewareRouter } from "./middleware/register.js";
|
|
12
17
|
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";
|
|
13
22
|
import { collectCssPaths, componentsModules } from "./streaming/collectCss.js";
|
|
14
23
|
import { createReactStreamingHandler } from "./streaming/createReactStreamingHandler.js";
|
|
15
24
|
import {
|
|
@@ -18,10 +27,13 @@ import {
|
|
|
18
27
|
getFullUrl
|
|
19
28
|
} from "./utils.js";
|
|
20
29
|
globalThis.__REDWOOD__PRERENDER_PAGES = {};
|
|
30
|
+
globalThis.__cedarjs__vite_ssr_runtime = void 0;
|
|
31
|
+
globalThis.__cedarjs__vite_rsc_runtime = void 0;
|
|
21
32
|
async function createServer() {
|
|
22
33
|
ensureProcessDirWeb();
|
|
23
34
|
registerFwGlobalsAndShims();
|
|
24
35
|
const app = express();
|
|
36
|
+
const server = http.createServer(app);
|
|
25
37
|
const rwPaths = getPaths();
|
|
26
38
|
const rscEnabled = getConfig().experimental.rsc?.enabled ?? false;
|
|
27
39
|
const serverStorage = createServerStorage();
|
|
@@ -44,8 +56,78 @@ async function createServer() {
|
|
|
44
56
|
"Vite config not found. Please set up Vite before running the dev server."
|
|
45
57
|
);
|
|
46
58
|
}
|
|
47
|
-
const
|
|
59
|
+
const viteSsrDevServer = await createViteServer({
|
|
48
60
|
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
|
+
},
|
|
49
131
|
plugins: [
|
|
50
132
|
cjsInterop({
|
|
51
133
|
dependencies: [
|
|
@@ -59,16 +141,183 @@ async function createServer() {
|
|
|
59
141
|
"@cedarjs/auth-!(dbauth)-web"
|
|
60
142
|
]
|
|
61
143
|
}),
|
|
62
|
-
rscEnabled && rscRoutesAutoLoader()
|
|
144
|
+
rscEnabled && rscRoutesAutoLoader(),
|
|
145
|
+
rscEnabled && rscSsrRouterImport()
|
|
63
146
|
],
|
|
64
147
|
server: { middlewareMode: true },
|
|
65
148
|
logLevel: "info",
|
|
66
149
|
clearScreen: false,
|
|
67
150
|
appType: "custom"
|
|
68
151
|
});
|
|
152
|
+
globalThis.__cedarjs__vite_ssr_runtime = createServerModuleRunner(
|
|
153
|
+
viteSsrDevServer.environments.ssr
|
|
154
|
+
);
|
|
155
|
+
globalThis.__cedarjs__client_references = /* @__PURE__ */ new Set();
|
|
156
|
+
globalThis.__cedarjs__server_references = /* @__PURE__ */ new Set();
|
|
157
|
+
const viteRscServer = await createViteServer({
|
|
158
|
+
envFile: false,
|
|
159
|
+
define: {
|
|
160
|
+
"process.env.NODE_ENV": JSON.stringify(process.env.NODE_ENV)
|
|
161
|
+
},
|
|
162
|
+
ssr: {
|
|
163
|
+
// Inline every file apart from node built-ins. We want vite/rollup to
|
|
164
|
+
// inline dependencies in the server build. This gets round runtime
|
|
165
|
+
// importing of "server-only" and other packages with poisoned imports.
|
|
166
|
+
//
|
|
167
|
+
// Files included in `noExternal` are files we want Vite to analyze
|
|
168
|
+
// As of vite 5.2 `true` here means "all except node built-ins"
|
|
169
|
+
noExternal: true,
|
|
170
|
+
// TODO (RSC): Other frameworks build for RSC without `noExternal: true`.
|
|
171
|
+
// What are we missing here? When/why is that a better choice? I know
|
|
172
|
+
// we would have to explicitly add a bunch of packages to noExternal, if
|
|
173
|
+
// we wanted to go that route.
|
|
174
|
+
// noExternal: ['@tobbe.dev/rsc-test'],
|
|
175
|
+
// Can't inline prisma client (db calls fail at runtime) or react-dom
|
|
176
|
+
// (css pre-init failure)
|
|
177
|
+
// Server store has to be externalized, because it's a singleton (shared between FW and App)
|
|
178
|
+
external: [
|
|
179
|
+
"@prisma/client",
|
|
180
|
+
"@prisma/adapter-better-sqlite3",
|
|
181
|
+
"@prisma/fetch-engine",
|
|
182
|
+
"@prisma/internals",
|
|
183
|
+
"better-sqlite3",
|
|
184
|
+
"@cedarjs/auth-dbauth-api",
|
|
185
|
+
"@cedarjs/cookie-jar",
|
|
186
|
+
"@cedarjs/server-store",
|
|
187
|
+
"@cedarjs/structure",
|
|
188
|
+
"@simplewebauthn/server",
|
|
189
|
+
"graphql-scalars",
|
|
190
|
+
"minimatch",
|
|
191
|
+
"playwright",
|
|
192
|
+
"react-dom"
|
|
193
|
+
],
|
|
194
|
+
resolve: {
|
|
195
|
+
// These conditions are used in the plugin pipeline, and only affect non-externalized
|
|
196
|
+
// dependencies during the SSR build. Which because of `noExternal: true` means all
|
|
197
|
+
// dependencies apart from node built-ins.
|
|
198
|
+
// TODO (RSC): What's the difference between `conditions` and
|
|
199
|
+
// `externalConditions`? When is one used over the other?
|
|
200
|
+
// In Vite 6, we must include `defaultServerConditions` alongside
|
|
201
|
+
// `react-server` so that nested condition maps (e.g. the `node`
|
|
202
|
+
// sub-condition inside `react-server-dom-webpack/server`'s exports)
|
|
203
|
+
// can still be resolved. Without `node` (or another environment
|
|
204
|
+
// condition), the resolver throws "No known conditions for
|
|
205
|
+
// './server' specifier in 'react-server-dom-webpack' package".
|
|
206
|
+
conditions: ["react-server", ...defaultServerConditions],
|
|
207
|
+
externalConditions: ["react-server", ...defaultServerConditions]
|
|
208
|
+
},
|
|
209
|
+
optimizeDeps: {
|
|
210
|
+
// We need Vite to optimize these dependencies so that they are resolved
|
|
211
|
+
// with the correct conditions. And so that CJS modules work correctly.
|
|
212
|
+
include: [
|
|
213
|
+
"react/**/*",
|
|
214
|
+
"react-dom/server",
|
|
215
|
+
"react-dom/server.edge",
|
|
216
|
+
"rehackt",
|
|
217
|
+
"react-server-dom-webpack/server",
|
|
218
|
+
"react-server-dom-webpack/server.edge",
|
|
219
|
+
"react-server-dom-webpack/client",
|
|
220
|
+
"react-server-dom-webpack/client.edge",
|
|
221
|
+
"@apollo/client/cache/*",
|
|
222
|
+
"@apollo/client/utilities/*",
|
|
223
|
+
"@apollo/client/react/hooks/*",
|
|
224
|
+
"react-fast-compare",
|
|
225
|
+
"invariant",
|
|
226
|
+
"shallowequal",
|
|
227
|
+
"graphql/language/*",
|
|
228
|
+
"stacktracey",
|
|
229
|
+
"deepmerge",
|
|
230
|
+
"fast-glob",
|
|
231
|
+
"@whatwg-node/fetch",
|
|
232
|
+
"busboy",
|
|
233
|
+
"cookie"
|
|
234
|
+
],
|
|
235
|
+
// Ensure `util` resolves to Node's built-in module and not to
|
|
236
|
+
// Browserify's `node-util` polyfill (which lacks TextEncoder).
|
|
237
|
+
// The polyfill may be hoisted into node_modules by optional
|
|
238
|
+
// dependencies like `@cedarjs/storybook`.
|
|
239
|
+
exclude: ["util"]
|
|
240
|
+
}
|
|
241
|
+
},
|
|
242
|
+
resolve: {
|
|
243
|
+
// See comment above in ssr.resolve for why we include defaultServerConditions.
|
|
244
|
+
conditions: ["react-server", ...defaultServerConditions]
|
|
245
|
+
},
|
|
246
|
+
plugins: [
|
|
247
|
+
{
|
|
248
|
+
name: "rsc-record-and-tranform-use-client-plugin",
|
|
249
|
+
transform(code, id, _options) {
|
|
250
|
+
globalThis.__cedarjs__client_references?.delete(id);
|
|
251
|
+
if (!/^(["'])use client\1/.test(code)) {
|
|
252
|
+
return void 0;
|
|
253
|
+
}
|
|
254
|
+
console.log(
|
|
255
|
+
"rsc-record-and-transform-use-client-plugin: adding client reference",
|
|
256
|
+
id
|
|
257
|
+
);
|
|
258
|
+
globalThis.__cedarjs__client_references?.add(id);
|
|
259
|
+
const fns = code.matchAll(/export function (\w+)\(/g);
|
|
260
|
+
const consts = code.matchAll(/export const (\w+) = \(/g);
|
|
261
|
+
const names = [...fns, ...consts].map(([, name]) => name);
|
|
262
|
+
const result = [
|
|
263
|
+
`import { registerClientReference } from "react-server-dom-webpack/server.edge";`,
|
|
264
|
+
"",
|
|
265
|
+
...names.map((name) => {
|
|
266
|
+
return name === "default" ? `export default registerClientReference({}, "${id}", "${name}");` : `export const ${name} = registerClientReference({}, "${id}", "${name}");`;
|
|
267
|
+
})
|
|
268
|
+
].join("\n");
|
|
269
|
+
console.log("rsc-record-and-transform-use-client-plugin result");
|
|
270
|
+
console.log(
|
|
271
|
+
result.split("\n").map((line, i) => ` ${i + 1}: ${line}`).join("\n")
|
|
272
|
+
);
|
|
273
|
+
return { code: result, map: null };
|
|
274
|
+
}
|
|
275
|
+
},
|
|
276
|
+
rscTransformUseServerPlugin("", {}),
|
|
277
|
+
// The rscTransformUseClientPlugin maps paths like
|
|
278
|
+
// /Users/tobbe/.../rw-app/node_modules/@tobbe.dev/rsc-test/dist/rsc-test.es.js
|
|
279
|
+
// to
|
|
280
|
+
// /Users/tobbe/.../rw-app/web/dist/ssr/assets/rsc0.js
|
|
281
|
+
// That's why it needs the `clientEntryFiles` data
|
|
282
|
+
// (It does other things as well, but that's why it needs clientEntryFiles)
|
|
283
|
+
// rscTransformUseClientPlugin(clientEntryFiles),
|
|
284
|
+
// rscTransformUseServerPlugin(outDir, serverEntryFiles),
|
|
285
|
+
rscRoutesImports(),
|
|
286
|
+
{
|
|
287
|
+
name: "rsc-hot-update",
|
|
288
|
+
handleHotUpdate(ctx) {
|
|
289
|
+
console.log("rsc-hot-update ctx.modules", ctx.modules);
|
|
290
|
+
return [];
|
|
291
|
+
}
|
|
292
|
+
}
|
|
293
|
+
],
|
|
294
|
+
build: {
|
|
295
|
+
ssr: true
|
|
296
|
+
},
|
|
297
|
+
server: {
|
|
298
|
+
// We never call `viteRscServer.listen()`, so we should run this in
|
|
299
|
+
// middleware mode
|
|
300
|
+
middlewareMode: true,
|
|
301
|
+
// The hmr/fast-refresh websocket in this server collides with the one in
|
|
302
|
+
// the other Vite server. So we can either disable it or run it on a
|
|
303
|
+
// different port.
|
|
304
|
+
// TODO (RSC): Figure out if we should disable or just pick a different
|
|
305
|
+
// port
|
|
306
|
+
ws: false
|
|
307
|
+
// hmr: {
|
|
308
|
+
// port: 24679,
|
|
309
|
+
// },
|
|
310
|
+
},
|
|
311
|
+
appType: "custom",
|
|
312
|
+
// Using a unique cache dir here to not clash with our other vite server
|
|
313
|
+
cacheDir: "../node_modules/.vite-rsc"
|
|
314
|
+
});
|
|
315
|
+
globalThis.__cedarjs__vite_rsc_runtime = createServerModuleRunner(
|
|
316
|
+
viteRscServer.environments.ssr
|
|
317
|
+
);
|
|
69
318
|
const handleWithMiddleware = (route) => {
|
|
70
319
|
return createServerAdapter(async (req) => {
|
|
71
|
-
const middlewareRouter = await createMiddlewareRouter(
|
|
320
|
+
const middlewareRouter = await createMiddlewareRouter(viteSsrDevServer);
|
|
72
321
|
const middleware = middlewareRouter.find(
|
|
73
322
|
req.method,
|
|
74
323
|
req.url
|
|
@@ -78,19 +327,22 @@ async function createServer() {
|
|
|
78
327
|
}
|
|
79
328
|
const [mwRes] = await invoke(req, middleware, {
|
|
80
329
|
route,
|
|
81
|
-
|
|
330
|
+
viteSsrDevServer
|
|
82
331
|
});
|
|
83
332
|
return mwRes.toResponse();
|
|
84
333
|
});
|
|
85
334
|
};
|
|
86
|
-
app.use(
|
|
335
|
+
app.use(viteSsrDevServer.middlewares);
|
|
87
336
|
if (rscEnabled) {
|
|
88
|
-
|
|
337
|
+
createWebSocketServer();
|
|
338
|
+
const { createRscRequestHandler } = await globalThis.__cedarjs__vite_rsc_runtime.import(
|
|
339
|
+
new URL("./rsc/rscRequestHandler.js", import.meta.url).pathname
|
|
340
|
+
);
|
|
89
341
|
app.use(
|
|
90
342
|
"/rw-rsc",
|
|
91
|
-
createRscRequestHandler({
|
|
92
|
-
getMiddlewareRouter: async () => createMiddlewareRouter(
|
|
93
|
-
|
|
343
|
+
await createRscRequestHandler({
|
|
344
|
+
getMiddlewareRouter: async () => createMiddlewareRouter(viteSsrDevServer),
|
|
345
|
+
viteSsrDevServer
|
|
94
346
|
})
|
|
95
347
|
);
|
|
96
348
|
}
|
|
@@ -100,18 +352,22 @@ async function createServer() {
|
|
|
100
352
|
routes,
|
|
101
353
|
clientEntryPath: rwPaths.web.entryClient,
|
|
102
354
|
getStylesheetLinks: (route) => {
|
|
103
|
-
return getCssLinks({
|
|
355
|
+
return getCssLinks({
|
|
356
|
+
rwPaths,
|
|
357
|
+
route,
|
|
358
|
+
viteSsrDevServer
|
|
359
|
+
});
|
|
104
360
|
},
|
|
105
361
|
// Recreate middleware router on each request in dev
|
|
106
|
-
getMiddlewareRouter: async () => createMiddlewareRouter(
|
|
362
|
+
getMiddlewareRouter: async () => createMiddlewareRouter(viteSsrDevServer)
|
|
107
363
|
},
|
|
108
|
-
|
|
364
|
+
viteSsrDevServer
|
|
109
365
|
);
|
|
110
366
|
app.get("*", createServerAdapter(routeHandler));
|
|
111
367
|
app.post("*", handleWithMiddleware());
|
|
112
368
|
const port = getConfig().web.port;
|
|
113
369
|
console.log(`Started server on http://localhost:${port}`);
|
|
114
|
-
return
|
|
370
|
+
return server.listen(port);
|
|
115
371
|
}
|
|
116
372
|
let devApp = createServer();
|
|
117
373
|
process.stdin.on("data", async (data) => {
|
|
@@ -126,11 +382,11 @@ process.stdin.on("data", async (data) => {
|
|
|
126
382
|
function getCssLinks({
|
|
127
383
|
rwPaths,
|
|
128
384
|
route,
|
|
129
|
-
|
|
385
|
+
viteSsrDevServer
|
|
130
386
|
}) {
|
|
131
387
|
const appAndRouteModules = componentsModules(
|
|
132
388
|
[rwPaths.web.app, route?.filePath].filter(Boolean),
|
|
133
|
-
|
|
389
|
+
viteSsrDevServer
|
|
134
390
|
);
|
|
135
391
|
const collectedCss = collectCssPaths(appAndRouteModules);
|
|
136
392
|
const cssLinks = Array.from(collectedCss);
|
package/dist/index.d.ts
CHANGED
|
@@ -2,12 +2,14 @@ import type { PluginOption } from 'vite';
|
|
|
2
2
|
export { cedarAutoImportsPlugin } from './plugins/vite-plugin-cedar-auto-import.js';
|
|
3
3
|
export { cedarCjsCompatPlugin } from './plugins/vite-plugin-cedar-cjs-compat.js';
|
|
4
4
|
export { cedarCellTransform } from './plugins/vite-plugin-cedar-cell.js';
|
|
5
|
-
export {
|
|
6
|
-
export {
|
|
5
|
+
export { cedarGqlormInjectPlugin } from './plugins/vite-plugin-cedar-gqlorm-inject.js';
|
|
6
|
+
export { cedarGraphqlOptionsExtractPlugin } from './plugins/vite-plugin-cedar-graphql-options-extract.js';
|
|
7
|
+
export { handlerAlsWrappingPlugin } from './plugins/vite-plugin-handler-als-wrapping.js';
|
|
8
|
+
export { applyHandlerAlsWrapping } from './plugins/vite-plugin-handler-als-wrapping.js';
|
|
7
9
|
export { cedarEntryInjectionPlugin } from './plugins/vite-plugin-cedar-entry-injection.js';
|
|
8
10
|
export { cedarHtmlEnvPlugin } from './plugins/vite-plugin-cedar-html-env.js';
|
|
9
11
|
export { cedarImportDirPlugin } from './plugins/vite-plugin-cedar-import-dir.js';
|
|
10
|
-
export {
|
|
12
|
+
export { cedarDataUriShim } from './plugins/vite-plugin-cedar-data-uri-shim.js';
|
|
11
13
|
export { cedarRemoveDevFatalErrorPage } from './plugins/vite-plugin-cedar-remove-dev-fatal-error-page.js';
|
|
12
14
|
export { cedarRoutesAutoLoaderPlugin } from './plugins/vite-plugin-cedar-routes-auto-loader.js';
|
|
13
15
|
export { cedarRemoveFromBundle } from './plugins/vite-plugin-cedar-remove-from-bundle.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,MAAM,CAAA;AAuBxC,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,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,MAAM,CAAA;AAuBxC,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,wBAAwB,EAAE,MAAM,+CAA+C,CAAA;AACxF,OAAO,EAAE,uBAAuB,EAAE,MAAM,+CAA+C,CAAA;AACvF,OAAO,EAAE,yBAAyB,EAAE,MAAM,gDAAgD,CAAA;AAC1F,OAAO,EAAE,kBAAkB,EAAE,MAAM,yCAAyC,CAAA;AAC5E,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,qBAAqB,EAAE,MAAM,qCAAqC,CAAA;AAC3E,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;CAC1B,CAAA;AAED;;GAEG;AACH,wBAAgB,KAAK,CAAC,EAAE,IAAI,EAAE,GAAE,aAAkB,GAAG,YAAY,EAAE,CAgClE;AAED,8DAA8D;AAC9D,eAAe,KAAK,CAAA"}
|
package/dist/index.js
CHANGED
|
@@ -7,9 +7,9 @@ import {
|
|
|
7
7
|
createAuthImportTransformPlugin
|
|
8
8
|
} from "@cedarjs/testing/web/vitest";
|
|
9
9
|
import { cedarCellTransform } from "./plugins/vite-plugin-cedar-cell.js";
|
|
10
|
+
import { cedarDataUriShim } from "./plugins/vite-plugin-cedar-data-uri-shim.js";
|
|
10
11
|
import { cedarEntryInjectionPlugin } from "./plugins/vite-plugin-cedar-entry-injection.js";
|
|
11
12
|
import { cedarHtmlEnvPlugin } from "./plugins/vite-plugin-cedar-html-env.js";
|
|
12
|
-
import { cedarNodePolyfills } from "./plugins/vite-plugin-cedar-node-polyfills.js";
|
|
13
13
|
import { cedarRemoveDevFatalErrorPage } from "./plugins/vite-plugin-cedar-remove-dev-fatal-error-page.js";
|
|
14
14
|
import { cedarRemoveFromBundle } from "./plugins/vite-plugin-cedar-remove-from-bundle.js";
|
|
15
15
|
import { cedarRoutesAutoLoaderPlugin } from "./plugins/vite-plugin-cedar-routes-auto-loader.js";
|
|
@@ -21,12 +21,14 @@ import { cedarSwapApolloProvider } from "./plugins/vite-plugin-swap-apollo-provi
|
|
|
21
21
|
import { cedarAutoImportsPlugin } from "./plugins/vite-plugin-cedar-auto-import.js";
|
|
22
22
|
import { cedarCjsCompatPlugin } from "./plugins/vite-plugin-cedar-cjs-compat.js";
|
|
23
23
|
import { cedarCellTransform as cedarCellTransform2 } from "./plugins/vite-plugin-cedar-cell.js";
|
|
24
|
-
import {
|
|
25
|
-
import {
|
|
24
|
+
import { cedarGqlormInjectPlugin } from "./plugins/vite-plugin-cedar-gqlorm-inject.js";
|
|
25
|
+
import { cedarGraphqlOptionsExtractPlugin } from "./plugins/vite-plugin-cedar-graphql-options-extract.js";
|
|
26
|
+
import { handlerAlsWrappingPlugin } from "./plugins/vite-plugin-handler-als-wrapping.js";
|
|
27
|
+
import { applyHandlerAlsWrapping } from "./plugins/vite-plugin-handler-als-wrapping.js";
|
|
26
28
|
import { cedarEntryInjectionPlugin as cedarEntryInjectionPlugin2 } from "./plugins/vite-plugin-cedar-entry-injection.js";
|
|
27
29
|
import { cedarHtmlEnvPlugin as cedarHtmlEnvPlugin2 } from "./plugins/vite-plugin-cedar-html-env.js";
|
|
28
30
|
import { cedarImportDirPlugin } from "./plugins/vite-plugin-cedar-import-dir.js";
|
|
29
|
-
import {
|
|
31
|
+
import { cedarDataUriShim as cedarDataUriShim2 } from "./plugins/vite-plugin-cedar-data-uri-shim.js";
|
|
30
32
|
import { cedarRemoveDevFatalErrorPage as cedarRemoveDevFatalErrorPage2 } from "./plugins/vite-plugin-cedar-remove-dev-fatal-error-page.js";
|
|
31
33
|
import { cedarRoutesAutoLoaderPlugin as cedarRoutesAutoLoaderPlugin2 } from "./plugins/vite-plugin-cedar-routes-auto-loader.js";
|
|
32
34
|
import { cedarRemoveFromBundle as cedarRemoveFromBundle2 } from "./plugins/vite-plugin-cedar-remove-from-bundle.js";
|
|
@@ -51,7 +53,7 @@ function cedar({ mode } = {}) {
|
|
|
51
53
|
mode === "test" && createAuthImportTransformPlugin(),
|
|
52
54
|
mode === "test" && autoImportsPlugin(),
|
|
53
55
|
cedarWaitForApiServer(),
|
|
54
|
-
|
|
56
|
+
cedarDataUriShim(),
|
|
55
57
|
cedarHtmlEnvPlugin(),
|
|
56
58
|
cedarEntryInjectionPlugin(),
|
|
57
59
|
cedarMergedConfig(),
|
|
@@ -68,17 +70,18 @@ function cedar({ mode } = {}) {
|
|
|
68
70
|
}
|
|
69
71
|
var index_default = cedar;
|
|
70
72
|
export {
|
|
71
|
-
|
|
73
|
+
applyHandlerAlsWrapping,
|
|
72
74
|
cedar,
|
|
73
75
|
cedarAutoImportsPlugin,
|
|
74
76
|
cedarCellTransform2 as cedarCellTransform,
|
|
75
77
|
cedarCjsCompatPlugin,
|
|
76
|
-
|
|
78
|
+
cedarDataUriShim2 as cedarDataUriShim,
|
|
77
79
|
cedarEntryInjectionPlugin2 as cedarEntryInjectionPlugin,
|
|
80
|
+
cedarGqlormInjectPlugin,
|
|
81
|
+
cedarGraphqlOptionsExtractPlugin,
|
|
78
82
|
cedarHtmlEnvPlugin2 as cedarHtmlEnvPlugin,
|
|
79
83
|
cedarImportDirPlugin,
|
|
80
84
|
cedarMergedConfig2 as cedarMergedConfig,
|
|
81
|
-
cedarNodePolyfills2 as cedarNodePolyfills,
|
|
82
85
|
cedarRemoveDevFatalErrorPage2 as cedarRemoveDevFatalErrorPage,
|
|
83
86
|
cedarRemoveFromBundle2 as cedarRemoveFromBundle,
|
|
84
87
|
cedarRoutesAutoLoaderPlugin2 as cedarRoutesAutoLoaderPlugin,
|
|
@@ -88,5 +91,6 @@ export {
|
|
|
88
91
|
cedarWaitForApiServer2 as cedarWaitForApiServer,
|
|
89
92
|
cedarjsJobPathInjectorPlugin,
|
|
90
93
|
cedarjsResolveCedarStyleImportsPlugin2 as cedarjsResolveCedarStyleImportsPlugin,
|
|
91
|
-
index_default as default
|
|
94
|
+
index_default as default,
|
|
95
|
+
handlerAlsWrappingPlugin
|
|
92
96
|
};
|
|
@@ -55,6 +55,15 @@ function registerFwShims() {
|
|
|
55
55
|
globalThis.__rw_module_cache__ ||= /* @__PURE__ */ new Map();
|
|
56
56
|
globalThis.__webpack_chunk_load__ ||= async (id) => {
|
|
57
57
|
console.log("registerFwShims chunk load id", id);
|
|
58
|
+
if (globalThis.__cedarjs__vite_ssr_runtime) {
|
|
59
|
+
return globalThis.__cedarjs__vite_ssr_runtime?.import(id).then((mod) => {
|
|
60
|
+
console.log("registerFwShims chunk load mod", mod);
|
|
61
|
+
if (mod.default && typeof mod.default === "object") {
|
|
62
|
+
return globalThis.__rw_module_cache__.set(id, mod.default);
|
|
63
|
+
}
|
|
64
|
+
return globalThis.__rw_module_cache__.set(id, mod);
|
|
65
|
+
});
|
|
66
|
+
}
|
|
58
67
|
return import(id).then((mod) => {
|
|
59
68
|
console.log("registerFwShims chunk load mod", mod);
|
|
60
69
|
if (mod.default && typeof mod.default === "object") {
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"vite-plugin-cedar-data-uri-shim.d.ts","sourceRoot":"","sources":["../../src/plugins/vite-plugin-cedar-data-uri-shim.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,MAAM,CAAA;AAgClC,wBAAgB,gBAAgB,IAAI,MAAM,GAAG,SAAS,CA4BrD"}
|