rwsdk 1.2.4-test.20260428112212 → 1.2.5
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/runtime/render/assembleDocument.js +1 -1
- package/dist/runtime/render/renderDocumentHtmlStream.js +1 -1
- package/dist/runtime/render/stylesheets.js +0 -22
- package/dist/vite/buildApp.mjs +3 -18
- package/dist/vite/configPlugin.mjs +17 -24
- package/dist/vite/createDirectiveLookupPlugin.mjs +15 -11
- package/dist/vite/directiveModulesDevPlugin.mjs +44 -28
- package/dist/vite/directivesFilteringPlugin.mjs +0 -3
- package/dist/vite/directivesPlugin.mjs +87 -44
- package/dist/vite/knownDepsResolverPlugin.mjs +36 -29
- package/dist/vite/linkerPlugin.mjs +1 -1
- package/dist/vite/prismaPlugin.mjs +10 -7
- package/dist/vite/redwoodPlugin.mjs +2 -0
- package/dist/vite/ssrBridgePlugin.mjs +20 -8
- package/dist/vite/statePlugin.mjs +15 -8
- package/dist/vite/transformJsxScriptTagsPlugin.mjs +3 -3
- package/dist/vite/vitePreamblePlugin.d.mts +153 -2
- package/package.json +18 -17
- package/dist/vite/addOptimizeDepsPlugin.d.mts +0 -10
- package/dist/vite/addOptimizeDepsPlugin.mjs +0 -6
|
@@ -17,6 +17,6 @@ export const assembleDocument = ({ requestInfo, pageElement, shouldSSR, }) => {
|
|
|
17
17
|
};
|
|
18
18
|
const Document = requestInfo.rw.Document;
|
|
19
19
|
return (_jsxs(Document, { ...requestInfo, children: [_jsx("script", { nonce: requestInfo.rw.nonce, dangerouslySetInnerHTML: {
|
|
20
|
-
__html: `globalThis.__RWSDK_CONTEXT = ${JSON.stringify(clientContext)}
|
|
20
|
+
__html: `globalThis.__RWSDK_CONTEXT = ${JSON.stringify(clientContext)}`,
|
|
21
21
|
} }), _jsx(Stylesheets, { requestInfo: requestInfo }), _jsx(Preloads, { requestInfo: requestInfo }), _jsx("div", { id: "hydrate-root", children: pageElement })] }));
|
|
22
22
|
};
|
|
@@ -20,7 +20,7 @@ export const renderDocumentHtmlStream = async ({ rscPayloadStream, Document, req
|
|
|
20
20
|
};
|
|
21
21
|
// Create the outer document with a marker for injection
|
|
22
22
|
const documentElement = (_jsxs(Document, { ...requestInfo, children: [_jsx("script", { nonce: requestInfo.rw.nonce, dangerouslySetInnerHTML: {
|
|
23
|
-
__html: `globalThis.__RWSDK_CONTEXT = ${JSON.stringify(clientContext)}
|
|
23
|
+
__html: `globalThis.__RWSDK_CONTEXT = ${JSON.stringify(clientContext)}`,
|
|
24
24
|
} }), _jsx(Stylesheets, { requestInfo: requestInfo }), _jsx(Preloads, { requestInfo: requestInfo }), _jsx("div", { id: "hydrate-root", children: _jsx("div", { id: "rwsdk-app-start" }) })] }));
|
|
25
25
|
const outerHtmlStream = await renderHtmlStream({
|
|
26
26
|
node: documentElement,
|
|
@@ -23,20 +23,6 @@ const findCssForModule = (scriptId, manifest) => {
|
|
|
23
23
|
css.add(href);
|
|
24
24
|
}
|
|
25
25
|
}
|
|
26
|
-
// context(justinvdm, 2026-04-23): Rolldown associates CSS with the
|
|
27
|
-
// chunk that imports the CSS file, which may be a dynamic import target
|
|
28
|
-
// rather than the entry chunk. Walk both static and dynamic imports to
|
|
29
|
-
// find CSS from transitive dependencies.
|
|
30
|
-
if (entry.imports) {
|
|
31
|
-
for (const importId of entry.imports) {
|
|
32
|
-
inner(importId);
|
|
33
|
-
}
|
|
34
|
-
}
|
|
35
|
-
if (entry.dynamicImports) {
|
|
36
|
-
for (const importId of entry.dynamicImports) {
|
|
37
|
-
inner(importId);
|
|
38
|
-
}
|
|
39
|
-
}
|
|
40
26
|
};
|
|
41
27
|
inner(scriptId);
|
|
42
28
|
return Array.from(css);
|
|
@@ -51,13 +37,5 @@ export const Stylesheets = async ({ requestInfo, }) => {
|
|
|
51
37
|
allStylesheets.add(toAbsoluteHref(entry));
|
|
52
38
|
}
|
|
53
39
|
}
|
|
54
|
-
for (const [, entry] of Object.entries(manifest)) {
|
|
55
|
-
if (entry.isEntry) {
|
|
56
|
-
const css = findCssForModule(entry.src ?? "", manifest);
|
|
57
|
-
for (const href of css) {
|
|
58
|
-
allStylesheets.add(toAbsoluteHref(href));
|
|
59
|
-
}
|
|
60
|
-
}
|
|
61
|
-
}
|
|
62
40
|
return (_jsx(_Fragment, { children: Array.from(allStylesheets).map((href) => (_jsx("link", { rel: "stylesheet", href: href, precedence: "first" }, href))) }));
|
|
63
41
|
};
|
package/dist/vite/buildApp.mjs
CHANGED
|
@@ -63,29 +63,14 @@ export async function buildApp({ builder, clientEntryPoints, clientFiles, server
|
|
|
63
63
|
clientEnv.config.build ??= {};
|
|
64
64
|
clientEnv.config.build.rollupOptions ??= {};
|
|
65
65
|
const clientEntryPointsArray = Array.from(clientEntryPoints);
|
|
66
|
-
// context(justinvdm, 2026-04-23): Vite 7's Rollup tolerated a missing
|
|
67
|
-
// src/client.tsx default input (silent empty bundle). Vite 8's Rolldown
|
|
68
|
-
// raises [UNRESOLVED_ENTRY] / [INVALID_OPTION] when input doesn't resolve
|
|
69
|
-
// or is empty. Only fall back to the default if the file actually exists,
|
|
70
|
-
// and skip the client build entirely if there's nothing to build.
|
|
71
|
-
let runClientBuild = true;
|
|
72
66
|
if (clientEntryPointsArray.length === 0) {
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
log("No client entry points discovered, using default: src/client.tsx");
|
|
76
|
-
clientEnv.config.build.rollupOptions.input = ["src/client.tsx"];
|
|
77
|
-
}
|
|
78
|
-
else {
|
|
79
|
-
log("No client entry points discovered and src/client.tsx not present; skipping client build");
|
|
80
|
-
runClientBuild = false;
|
|
81
|
-
}
|
|
67
|
+
log("No client entry points discovered, using default: src/client.tsx");
|
|
68
|
+
clientEnv.config.build.rollupOptions.input = ["src/client.tsx"];
|
|
82
69
|
}
|
|
83
70
|
else {
|
|
84
71
|
clientEnv.config.build.rollupOptions.input = clientEntryPointsArray;
|
|
85
72
|
}
|
|
86
|
-
|
|
87
|
-
await builder.build(clientEnv);
|
|
88
|
-
}
|
|
73
|
+
await builder.build(clientEnv);
|
|
89
74
|
console.log("Linking worker build...");
|
|
90
75
|
process.env.RWSDK_BUILD_PASS = "linker";
|
|
91
76
|
// Re-configure the worker environment for the linking pass
|
|
@@ -45,13 +45,11 @@ export const configPlugin = ({ silent, projectRootDir, workerEntryPathname, clie
|
|
|
45
45
|
],
|
|
46
46
|
exclude: [],
|
|
47
47
|
entries: [workerEntryPathname],
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
"__webpack_require__": "globalThis.__webpack_require__",
|
|
54
|
-
},
|
|
48
|
+
esbuildOptions: {
|
|
49
|
+
jsx: "automatic",
|
|
50
|
+
jsxImportSource: "react",
|
|
51
|
+
define: {
|
|
52
|
+
"process.env.NODE_ENV": JSON.stringify(mode),
|
|
55
53
|
},
|
|
56
54
|
},
|
|
57
55
|
},
|
|
@@ -67,9 +65,6 @@ export const configPlugin = ({ silent, projectRootDir, workerEntryPathname, clie
|
|
|
67
65
|
appType: "custom",
|
|
68
66
|
mode,
|
|
69
67
|
logLevel: silent ? "silent" : "info",
|
|
70
|
-
resolve: {
|
|
71
|
-
tsconfigPaths: true,
|
|
72
|
-
},
|
|
73
68
|
build: {
|
|
74
69
|
minify: mode !== "development",
|
|
75
70
|
sourcemap: true,
|
|
@@ -104,13 +99,12 @@ export const configPlugin = ({ silent, projectRootDir, workerEntryPathname, clie
|
|
|
104
99
|
"rwsdk/turnstile",
|
|
105
100
|
],
|
|
106
101
|
entries: [],
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
},
|
|
102
|
+
esbuildOptions: {
|
|
103
|
+
jsx: "automatic",
|
|
104
|
+
jsxImportSource: "react",
|
|
105
|
+
plugins: [],
|
|
106
|
+
define: {
|
|
107
|
+
"process.env.NODE_ENV": JSON.stringify(mode),
|
|
114
108
|
},
|
|
115
109
|
},
|
|
116
110
|
},
|
|
@@ -142,13 +136,12 @@ export const configPlugin = ({ silent, projectRootDir, workerEntryPathname, clie
|
|
|
142
136
|
"rwsdk/realtime/durableObject",
|
|
143
137
|
"rwsdk/realtime/worker",
|
|
144
138
|
],
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
},
|
|
139
|
+
esbuildOptions: {
|
|
140
|
+
jsx: "automatic",
|
|
141
|
+
jsxImportSource: "react",
|
|
142
|
+
plugins: [],
|
|
143
|
+
define: {
|
|
144
|
+
"process.env.NODE_ENV": JSON.stringify(mode),
|
|
152
145
|
},
|
|
153
146
|
},
|
|
154
147
|
},
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import debug from "debug";
|
|
2
2
|
import MagicString from "magic-string";
|
|
3
3
|
import path from "path";
|
|
4
|
-
import { addOptimizeDepsPlugin } from "./addOptimizeDepsPlugin.mjs";
|
|
5
4
|
import { VENDOR_CLIENT_BARREL_EXPORT_PATH, VENDOR_SERVER_BARREL_EXPORT_PATH, } from "../lib/constants.mjs";
|
|
6
5
|
export function generateLookupMap({ files, isDev, kind, exportName, }) {
|
|
7
6
|
const s = new MagicString(`
|
|
@@ -56,27 +55,32 @@ export const createDirectiveLookupPlugin = async ({ projectRootDir, files, confi
|
|
|
56
55
|
return;
|
|
57
56
|
}
|
|
58
57
|
log("Configuring environment: env=%s", env);
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
58
|
+
viteConfig.optimizeDeps ??= {};
|
|
59
|
+
viteConfig.optimizeDeps.esbuildOptions ??= {};
|
|
60
|
+
viteConfig.optimizeDeps.esbuildOptions.plugins ??= [];
|
|
61
|
+
viteConfig.optimizeDeps.esbuildOptions.plugins.push({
|
|
63
62
|
name: `rwsdk:${config.pluginName}`,
|
|
64
|
-
|
|
65
|
-
|
|
63
|
+
setup(build) {
|
|
64
|
+
log("Setting up esbuild plugin for %s", config.virtualModuleName);
|
|
65
|
+
// Handle both direct virtual module name and /@id/ prefixed version
|
|
66
|
+
const escapedVirtualModuleName = config.virtualModuleName.replace(/[-\/\\^$*+?.()|[\]{}]/g, "\\$&");
|
|
67
|
+
const escapedPrefixedModuleName = `/@id/${config.virtualModuleName}`.replace(/[-\/\\^$*+?.()|[\]{}]/g, "\\$&");
|
|
68
|
+
build.onResolve({
|
|
69
|
+
filter: new RegExp(`^(${escapedVirtualModuleName}|${escapedPrefixedModuleName})\\.js$`),
|
|
70
|
+
}, () => {
|
|
66
71
|
process.env.VERBOSE &&
|
|
67
|
-
log("
|
|
72
|
+
log("Esbuild onResolve: marking %s as external", config.virtualModuleName);
|
|
68
73
|
return {
|
|
69
|
-
|
|
74
|
+
path: `${config.virtualModuleName}.js`,
|
|
70
75
|
external: true,
|
|
71
76
|
};
|
|
72
|
-
}
|
|
77
|
+
});
|
|
73
78
|
},
|
|
74
79
|
});
|
|
75
80
|
const shouldOptimizeForEnv = !config.optimizeForEnvironments ||
|
|
76
81
|
config.optimizeForEnvironments.includes(env);
|
|
77
82
|
if (shouldOptimizeForEnv) {
|
|
78
83
|
log("Applying optimizeDeps and aliasing for environment: %s", env);
|
|
79
|
-
viteConfig.optimizeDeps ??= {};
|
|
80
84
|
viteConfig.optimizeDeps.include ??= [];
|
|
81
85
|
for (const file of files) {
|
|
82
86
|
if (file.includes("node_modules")) {
|
|
@@ -99,36 +99,52 @@ export const directiveModulesDevPlugin = ({ clientFiles, serverFiles, projectRoo
|
|
|
99
99
|
else if (envName === "worker") {
|
|
100
100
|
entries.push(APP_SERVER_BARREL_PATH);
|
|
101
101
|
}
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
];
|
|
106
|
-
const appBarrelFilter = new RegExp(`(${appBarrelPaths
|
|
107
|
-
.map((p) => p.replace(/\\/g, "\\\\"))
|
|
108
|
-
.join("|")})$`);
|
|
109
|
-
const BARREL_PREFIX = "\0rwsdk-app-barrel:";
|
|
110
|
-
env.optimizeDeps.rolldownOptions ??= {};
|
|
111
|
-
env.optimizeDeps.rolldownOptions.plugins ??= [];
|
|
112
|
-
env.optimizeDeps.rolldownOptions.plugins.unshift({
|
|
102
|
+
env.optimizeDeps.esbuildOptions ??= {};
|
|
103
|
+
env.optimizeDeps.esbuildOptions.plugins ??= [];
|
|
104
|
+
env.optimizeDeps.esbuildOptions.plugins.unshift({
|
|
113
105
|
name: "rwsdk:app-barrel-blocker",
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
106
|
+
setup(build) {
|
|
107
|
+
const appBarrelPaths = [
|
|
108
|
+
APP_CLIENT_BARREL_PATH,
|
|
109
|
+
APP_SERVER_BARREL_PATH,
|
|
110
|
+
];
|
|
111
|
+
const appBarrelFilter = new RegExp(`(${appBarrelPaths
|
|
112
|
+
.map((p) => p.replace(/\\/g, "\\\\"))
|
|
113
|
+
.join("|")})$`);
|
|
114
|
+
build.onResolve({ filter: /.*/ }, async (args) => {
|
|
115
|
+
// Block all resolutions until the scan is complete.
|
|
116
|
+
await scanPromise;
|
|
117
|
+
// Handle app barrel files
|
|
118
|
+
if (appBarrelFilter.test(args.path)) {
|
|
119
|
+
return {
|
|
120
|
+
path: args.path,
|
|
121
|
+
namespace: "rwsdk-app-barrel-ns",
|
|
122
|
+
};
|
|
123
|
+
}
|
|
124
|
+
// context(justinvdm, 11 Sep 2025): Prevent Vite from
|
|
125
|
+
// externalizing our application files. If we don't, paths
|
|
126
|
+
// imported in our application barrel files will be marked as
|
|
127
|
+
// external, and thus not scanned for dependencies.
|
|
128
|
+
if (args.path.startsWith("/") &&
|
|
129
|
+
(args.path.includes("/src/") ||
|
|
130
|
+
args.path.includes("/generated/")) &&
|
|
131
|
+
!args.path.includes("node_modules")) {
|
|
132
|
+
// By returning a result, we claim the module and prevent vite:dep-scan
|
|
133
|
+
// from marking it as external.
|
|
134
|
+
return {
|
|
135
|
+
path: args.path,
|
|
136
|
+
};
|
|
137
|
+
}
|
|
138
|
+
});
|
|
139
|
+
build.onLoad({ filter: /.*/, namespace: "rwsdk-app-barrel-ns" }, (args) => {
|
|
140
|
+
const isServerBarrel = args.path.includes("app-server-barrel");
|
|
129
141
|
const files = isServerBarrel ? serverFiles : clientFiles;
|
|
130
|
-
|
|
131
|
-
|
|
142
|
+
const content = generateAppBarrelContent(files, projectRootDir);
|
|
143
|
+
return {
|
|
144
|
+
contents: content,
|
|
145
|
+
loader: "js",
|
|
146
|
+
};
|
|
147
|
+
});
|
|
132
148
|
},
|
|
133
149
|
});
|
|
134
150
|
}
|
|
@@ -19,9 +19,6 @@ export const directivesFilteringPlugin = ({ clientFiles, serverFiles, projectRoo
|
|
|
19
19
|
absolute: true,
|
|
20
20
|
});
|
|
21
21
|
const info = this.getModuleInfo(absoluteId);
|
|
22
|
-
// context(justinvdm, 2026-04-23): Rollup exposes `isIncluded` on
|
|
23
|
-
// ModuleInfo; Rolldown (Vite 8) does not. Treat absent as "included"
|
|
24
|
-
// so we only delete on an explicit `false` from Rollup.
|
|
25
22
|
if (!info ||
|
|
26
23
|
(typeof info.isIncluded !== "undefined" && !info.isIncluded)) {
|
|
27
24
|
files.delete(id);
|
|
@@ -2,7 +2,6 @@ import debug from "debug";
|
|
|
2
2
|
import fs from "node:fs/promises";
|
|
3
3
|
import path from "node:path";
|
|
4
4
|
import { normalizeModulePath } from "../lib/normalizeModulePath.mjs";
|
|
5
|
-
import { addOptimizeDepsPlugin } from "./addOptimizeDepsPlugin.mjs";
|
|
6
5
|
import { transformClientComponents } from "./transformClientComponents.mjs";
|
|
7
6
|
import { transformServerFunctions } from "./transformServerFunctions.mjs";
|
|
8
7
|
const log = debug("rwsdk:vite:rsc-directives-plugin");
|
|
@@ -93,56 +92,100 @@ export const directivesPlugin = ({ projectRootDir, clientFiles, serverFiles, })
|
|
|
93
92
|
return;
|
|
94
93
|
}
|
|
95
94
|
process.env.VERBOSE && log("Configuring environment: env=%s", env);
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
95
|
+
config.optimizeDeps ??= {};
|
|
96
|
+
config.optimizeDeps.esbuildOptions ??= {};
|
|
97
|
+
config.optimizeDeps.esbuildOptions.plugins ??= [];
|
|
98
|
+
config.optimizeDeps.esbuildOptions.plugins.push({
|
|
99
|
+
name: "rsc-directives-esbuild-transform",
|
|
100
|
+
setup(build) {
|
|
101
|
+
log("Setting up esbuild plugin for environment: %s", env);
|
|
102
|
+
build.onLoad({ filter: /\.(js|ts|jsx|tsx|mts|mjs|cjs)$/ }, async (args) => {
|
|
103
|
+
process.env.VERBOSE &&
|
|
104
|
+
log("Esbuild onLoad called for environment=%s, path=%s", env, args.path);
|
|
105
|
+
const normalizedPath = normalizeModulePath(args.path, projectRootDir);
|
|
106
|
+
// context(justinvdm,2025-06-15): If we're in app code,
|
|
107
|
+
// we will be doing the transform work in the vite plugin hooks,
|
|
108
|
+
// the only reason we're in esbuild land for app code is for
|
|
109
|
+
// dependency discovery, so we can skip transform work
|
|
110
|
+
// and use heuristics instead - see below inside if block
|
|
111
|
+
if (!args.path.includes("node_modules")) {
|
|
112
|
+
if (clientFiles.has(normalizedPath)) {
|
|
113
|
+
// context(justinvdm,2025-06-15): If this is a client file:
|
|
114
|
+
// * for ssr and client envs we can skip so esbuild looks at the
|
|
115
|
+
// original source code to discovery dependencies
|
|
116
|
+
// * for worker env, the transform would have just created
|
|
117
|
+
// references and dropped all imports, so we can just return empty code
|
|
118
|
+
if (env === "client" || env === "ssr") {
|
|
119
|
+
log("Esbuild onLoad skipping client module in app code for client or ssr env, path=%s", args.path);
|
|
120
|
+
return undefined;
|
|
121
|
+
}
|
|
122
|
+
else {
|
|
123
|
+
log("Esbuild onLoad returning empty code for server module in app code for worker env, path=%s to bypass esbuild dependency discovery", args.path);
|
|
124
|
+
return {
|
|
125
|
+
contents: "",
|
|
126
|
+
loader: "js",
|
|
127
|
+
};
|
|
128
|
+
}
|
|
129
|
+
}
|
|
130
|
+
else if (serverFiles.has(normalizedPath)) {
|
|
131
|
+
// context(justinvdm,2025-06-15): If this is a server file:
|
|
132
|
+
// * for worker env, we can skip so esbuild looks at the
|
|
133
|
+
// original source code to discovery dependencies
|
|
134
|
+
// * for ssr and client envs, the transform would have just created
|
|
135
|
+
// references and dropped all imports, so we can just return empty code
|
|
136
|
+
if (env === "worker") {
|
|
137
|
+
log("Esbuild onLoad skipping server module in app code for worker env, path=%s", args.path);
|
|
138
|
+
return undefined;
|
|
139
|
+
}
|
|
140
|
+
else if (env === "ssr" || env === "client") {
|
|
141
|
+
log("Esbuild onLoad returning empty code for server module in app code for ssr or client env, path=%s", args.path);
|
|
142
|
+
return {
|
|
143
|
+
contents: "",
|
|
144
|
+
loader: "js",
|
|
145
|
+
};
|
|
146
|
+
}
|
|
147
|
+
}
|
|
103
148
|
}
|
|
104
|
-
|
|
105
|
-
|
|
149
|
+
let code;
|
|
150
|
+
try {
|
|
151
|
+
code = await fs.readFile(args.path, "utf-8");
|
|
106
152
|
}
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
153
|
+
catch {
|
|
154
|
+
process.env.VERBOSE &&
|
|
155
|
+
log("Failed to read file: %s, environment=%s", args.path, env);
|
|
110
156
|
return undefined;
|
|
111
157
|
}
|
|
112
|
-
|
|
113
|
-
|
|
158
|
+
const clientResult = await transformClientComponents(code, normalizedPath, {
|
|
159
|
+
environmentName: env,
|
|
160
|
+
clientFiles,
|
|
161
|
+
isEsbuild: true,
|
|
162
|
+
});
|
|
163
|
+
if (clientResult) {
|
|
164
|
+
process.env.VERBOSE &&
|
|
165
|
+
log("Esbuild client component transformation successful for environment=%s, path=%s", env, args.path);
|
|
166
|
+
process.env.VERBOSE &&
|
|
167
|
+
log("Esbuild client component transformation for environment=%s, path=%s, code: %j", env, args.path, clientResult.code);
|
|
168
|
+
return {
|
|
169
|
+
contents: clientResult.code,
|
|
170
|
+
loader: getLoader(args.path),
|
|
171
|
+
};
|
|
114
172
|
}
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
}
|
|
128
|
-
const serverResult = transformServerFunctions(code, normalizedPath, env, serverFiles);
|
|
129
|
-
if (serverResult) {
|
|
130
|
-
return { code: serverResult.code, moduleType: getLoader(filePath) };
|
|
131
|
-
}
|
|
132
|
-
return undefined;
|
|
133
|
-
}
|
|
134
|
-
addOptimizeDepsPlugin(config, {
|
|
135
|
-
name: "rsc-directives-transform",
|
|
136
|
-
async load(id) {
|
|
137
|
-
if (!directivesFileFilter.test(id)) {
|
|
138
|
-
return;
|
|
139
|
-
}
|
|
140
|
-
const result = await handleDirectivesLoad(id);
|
|
141
|
-
if (result) {
|
|
142
|
-
return { code: result.code, moduleType: result.moduleType };
|
|
143
|
-
}
|
|
173
|
+
const serverResult = transformServerFunctions(code, normalizedPath, env, serverFiles);
|
|
174
|
+
if (serverResult) {
|
|
175
|
+
process.env.VERBOSE &&
|
|
176
|
+
log("Esbuild server function transformation successful for environment=%s, path=%s", env, args.path);
|
|
177
|
+
return {
|
|
178
|
+
contents: serverResult.code,
|
|
179
|
+
loader: getLoader(args.path),
|
|
180
|
+
};
|
|
181
|
+
}
|
|
182
|
+
process.env.VERBOSE &&
|
|
183
|
+
log("Esbuild no transformation applied for environment=%s, path=%s", env, args.path);
|
|
184
|
+
});
|
|
144
185
|
},
|
|
145
186
|
});
|
|
187
|
+
process.env.VERBOSE &&
|
|
188
|
+
log("Environment configuration complete for env=%s", env);
|
|
146
189
|
},
|
|
147
190
|
};
|
|
148
191
|
};
|
|
@@ -91,34 +91,44 @@ export const knownDepsResolverPlugin = ({ projectRootDir, }) => {
|
|
|
91
91
|
// Log a clean summary instead of all the individual mappings
|
|
92
92
|
const totalMappings = Object.values(ENV_IMPORT_MAPPINGS).reduce((sum, mappings) => sum + mappings.size, 0);
|
|
93
93
|
log("Known dependencies resolver configured with %d total mappings across %d environments", totalMappings, Object.keys(ENV_IMPORT_MAPPINGS).length);
|
|
94
|
-
function
|
|
94
|
+
function createEsbuildResolverPlugin(envName, mappings) {
|
|
95
95
|
if (!mappings) {
|
|
96
96
|
return null;
|
|
97
97
|
}
|
|
98
|
+
// Create reverse mapping from slugified names to original imports
|
|
99
|
+
// Vite converts "react-dom/server.edge" -> "react-dom_server__edge"
|
|
100
|
+
// Pattern: / becomes _, . becomes __
|
|
98
101
|
const slugifiedToOriginal = new Map();
|
|
99
|
-
for (const [original] of mappings) {
|
|
102
|
+
for (const [original, resolved] of mappings) {
|
|
100
103
|
const slugified = original.replace(/\//g, "_").replace(/\./g, "__");
|
|
101
104
|
slugifiedToOriginal.set(slugified, original);
|
|
102
105
|
}
|
|
103
106
|
return {
|
|
104
|
-
name: `rwsdk:known-dependencies-resolver-${envName}`,
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
if (
|
|
110
|
-
|
|
107
|
+
name: `rwsdk:known-dependencies-resolver-esbuild-${envName}`,
|
|
108
|
+
setup(build) {
|
|
109
|
+
build.onResolve({ filter: /.*/ }, (args) => {
|
|
110
|
+
let resolved = mappings.get(args.path);
|
|
111
|
+
// If not found, check if it's a slugified version
|
|
112
|
+
if (!resolved) {
|
|
113
|
+
const originalImport = slugifiedToOriginal.get(args.path);
|
|
114
|
+
if (originalImport) {
|
|
115
|
+
resolved = mappings.get(originalImport);
|
|
116
|
+
}
|
|
111
117
|
}
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
resolved = resolveKnownImport(id, envName, projectRootDir);
|
|
115
|
-
}
|
|
116
|
-
if (resolved) {
|
|
117
|
-
if (id === "react-server-dom-webpack/client.edge") {
|
|
118
|
-
return;
|
|
118
|
+
if (!resolved) {
|
|
119
|
+
resolved = resolveKnownImport(args.path, envName, projectRootDir);
|
|
119
120
|
}
|
|
120
|
-
|
|
121
|
-
|
|
121
|
+
// Resolve for both entry points (importer === '') and regular imports
|
|
122
|
+
// Entry points come from optimizeDeps.include and are critical to intercept
|
|
123
|
+
if (resolved) {
|
|
124
|
+
if (args.path === "react-server-dom-webpack/client.edge") {
|
|
125
|
+
return;
|
|
126
|
+
}
|
|
127
|
+
return {
|
|
128
|
+
path: resolved,
|
|
129
|
+
};
|
|
130
|
+
}
|
|
131
|
+
});
|
|
122
132
|
},
|
|
123
133
|
};
|
|
124
134
|
}
|
|
@@ -142,20 +152,17 @@ export const knownDepsResolverPlugin = ({ projectRootDir, }) => {
|
|
|
142
152
|
config.environments[envName] = {};
|
|
143
153
|
}
|
|
144
154
|
const envConfig = config.environments[envName];
|
|
145
|
-
|
|
155
|
+
const esbuildPlugin = createEsbuildResolverPlugin(envName, mappings);
|
|
156
|
+
if (esbuildPlugin && mappings) {
|
|
146
157
|
envConfig.optimizeDeps ??= {};
|
|
147
|
-
envConfig.optimizeDeps.
|
|
148
|
-
envConfig.optimizeDeps.
|
|
149
|
-
envConfig.optimizeDeps.
|
|
150
|
-
envConfig.optimizeDeps.
|
|
151
|
-
envConfig.optimizeDeps.
|
|
152
|
-
const plugin = createResolverPlugin(envName, mappings);
|
|
153
|
-
if (plugin) {
|
|
154
|
-
envConfig.optimizeDeps.rolldownOptions.plugins.push(plugin);
|
|
155
|
-
}
|
|
158
|
+
envConfig.optimizeDeps.esbuildOptions ??= {};
|
|
159
|
+
envConfig.optimizeDeps.esbuildOptions.define ??= {};
|
|
160
|
+
envConfig.optimizeDeps.esbuildOptions.define["process.env.NODE_ENV"] = JSON.stringify(process.env.NODE_ENV);
|
|
161
|
+
envConfig.optimizeDeps.esbuildOptions.plugins ??= [];
|
|
162
|
+
envConfig.optimizeDeps.esbuildOptions.plugins.push(esbuildPlugin);
|
|
156
163
|
envConfig.optimizeDeps.include ??= [];
|
|
157
164
|
envConfig.optimizeDeps.include.push(...predefinedImports);
|
|
158
|
-
log("Added
|
|
165
|
+
log("Added esbuild plugin and optimizeDeps includes for environment: %s", envName);
|
|
159
166
|
}
|
|
160
167
|
const aliases = ensureAliasArray(envConfig);
|
|
161
168
|
for (const [find, replacement] of mappings) {
|
|
@@ -9,7 +9,7 @@ export function linkWorkerBundle({ code, manifestContent, projectRootDir, base,
|
|
|
9
9
|
const manifest = JSON.parse(manifestContent);
|
|
10
10
|
// 1. Replace the manifest placeholder with the actual manifest content.
|
|
11
11
|
log("Injecting manifest into worker bundle");
|
|
12
|
-
newCode = newCode.replace(/['"
|
|
12
|
+
newCode = newCode.replace(/['"]__RWSDK_MANIFEST_PLACEHOLDER__['"]/, manifestContent);
|
|
13
13
|
// 2. Replace asset placeholders with their final hashed paths.
|
|
14
14
|
log("Replacing asset placeholders in final worker bundle");
|
|
15
15
|
for (const [key, value] of Object.entries(manifest)) {
|
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import { resolve } from "node:path";
|
|
2
|
-
import { addOptimizeDepsPlugin } from "./addOptimizeDepsPlugin.mjs";
|
|
3
2
|
import { checkPrismaStatus } from "./checkIsUsingPrisma.mjs";
|
|
4
3
|
import { ensureAliasArray } from "./ensureAliasArray.mjs";
|
|
5
4
|
import { invalidateCacheIfPrismaClientChanged } from "./invalidateCacheIfPrismaClientChanged.mjs";
|
|
@@ -22,13 +21,17 @@ export const prismaPlugin = async ({ projectRootDir, }) => {
|
|
|
22
21
|
return;
|
|
23
22
|
}
|
|
24
23
|
const wasmPath = resolve(projectRootDir, "node_modules/.prisma/client/wasm.js");
|
|
25
|
-
|
|
26
|
-
|
|
24
|
+
config.optimizeDeps ??= {};
|
|
25
|
+
config.optimizeDeps.esbuildOptions ??= {};
|
|
26
|
+
config.optimizeDeps.esbuildOptions.plugins ??= [];
|
|
27
|
+
config.optimizeDeps.esbuildOptions.plugins.push({
|
|
27
28
|
name: "rwsdk:prisma",
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
return
|
|
31
|
-
|
|
29
|
+
setup(build) {
|
|
30
|
+
build.onResolve({ filter: /^.prisma\/client\/default/ }, async () => {
|
|
31
|
+
return {
|
|
32
|
+
path: wasmPath,
|
|
33
|
+
};
|
|
34
|
+
});
|
|
32
35
|
},
|
|
33
36
|
});
|
|
34
37
|
ensureAliasArray(config).push({
|
|
@@ -6,6 +6,7 @@ import { devServerConstantPlugin } from "./devServerConstant.mjs";
|
|
|
6
6
|
import { hasOwnCloudflareVitePlugin } from "./hasOwnCloudflareVitePlugin.mjs";
|
|
7
7
|
import { hasOwnReactVitePlugin } from "./hasOwnReactVitePlugin.mjs";
|
|
8
8
|
import reactPlugin from "@vitejs/plugin-react";
|
|
9
|
+
import tsconfigPaths from "vite-tsconfig-paths";
|
|
9
10
|
import { pathExists } from "fs-extra";
|
|
10
11
|
import { $ } from "../lib/$.mjs";
|
|
11
12
|
import { findWranglerConfig } from "../lib/findWranglerConfig.mjs";
|
|
@@ -111,6 +112,7 @@ export const redwoodPlugin = async (options = {}) => {
|
|
|
111
112
|
}),
|
|
112
113
|
knownDepsResolverPlugin({ projectRootDir }),
|
|
113
114
|
cloudflarePreInitPlugin(),
|
|
115
|
+
tsconfigPaths({ root: projectRootDir }),
|
|
114
116
|
shouldIncludeCloudflarePlugin
|
|
115
117
|
? cloudflare({
|
|
116
118
|
viteEnvironment: { name: "worker" },
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import debug from "debug";
|
|
2
2
|
import MagicString from "magic-string";
|
|
3
3
|
import { INTERMEDIATE_SSR_BRIDGE_PATH } from "../lib/constants.mjs";
|
|
4
|
-
import { addOptimizeDepsPlugin } from "./addOptimizeDepsPlugin.mjs";
|
|
5
4
|
import { externalModulesSet } from "./constants.mjs";
|
|
6
5
|
import { findSsrImportCallSites } from "./findSsrSpecifiers.mjs";
|
|
7
6
|
const log = debug("rwsdk:vite:ssr-bridge-plugin");
|
|
@@ -50,18 +49,31 @@ export const ssrBridgePlugin = ({ clientFiles, serverFiles, }) => {
|
|
|
50
49
|
configEnvironment(env, config) {
|
|
51
50
|
log("Configuring environment: env=%s", env);
|
|
52
51
|
if (env === "worker") {
|
|
52
|
+
// Configure esbuild to mark rwsdk/__ssr paths as external for worker environment
|
|
53
|
+
log("Configuring esbuild options for worker environment");
|
|
53
54
|
config.optimizeDeps ??= {};
|
|
55
|
+
config.optimizeDeps.esbuildOptions ??= {};
|
|
56
|
+
config.optimizeDeps.esbuildOptions.plugins ??= [];
|
|
54
57
|
config.optimizeDeps.include ??= [];
|
|
55
|
-
|
|
58
|
+
config.optimizeDeps.esbuildOptions.plugins.push({
|
|
56
59
|
name: "rwsdk-ssr-external",
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
60
|
+
setup(build) {
|
|
61
|
+
log("Setting up esbuild plugin to mark rwsdk/__ssr paths as external for worker");
|
|
62
|
+
build.onResolve({ filter: /.*$/ }, (args) => {
|
|
63
|
+
process.env.VERBOSE &&
|
|
64
|
+
log("Esbuild onResolve called for path=%s, args=%O", args.path, args);
|
|
65
|
+
if (args.path === "rwsdk/__ssr_bridge" ||
|
|
66
|
+
args.path.startsWith(VIRTUAL_SSR_PREFIX)) {
|
|
67
|
+
log("Marking as external: %s", args.path);
|
|
68
|
+
return {
|
|
69
|
+
path: args.path,
|
|
70
|
+
external: true,
|
|
71
|
+
};
|
|
72
|
+
}
|
|
73
|
+
});
|
|
63
74
|
},
|
|
64
75
|
});
|
|
76
|
+
log("Worker environment esbuild configuration complete");
|
|
65
77
|
}
|
|
66
78
|
},
|
|
67
79
|
async resolveId(id, importer, options) {
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import debug from "debug";
|
|
2
2
|
import fs from "node:fs/promises";
|
|
3
3
|
import { RW_STATE_EXPORT_PATH } from "../lib/constants.mjs";
|
|
4
|
-
import { addOptimizeDepsPlugin } from "./addOptimizeDepsPlugin.mjs";
|
|
5
4
|
import { maybeResolveEnvImport } from "./envResolvers.mjs";
|
|
6
5
|
const log = debug("rwsdk:vite:state-plugin");
|
|
7
6
|
const VIRTUAL_STATE_PREFIX = "virtual:rwsdk:state:";
|
|
@@ -23,14 +22,22 @@ export const statePlugin = ({ projectRootDir, }) => {
|
|
|
23
22
|
},
|
|
24
23
|
configEnvironment(env, config) {
|
|
25
24
|
if (env === "worker") {
|
|
26
|
-
|
|
27
|
-
|
|
25
|
+
config.optimizeDeps ??= {};
|
|
26
|
+
config.optimizeDeps.esbuildOptions ??= {};
|
|
27
|
+
config.optimizeDeps.esbuildOptions.plugins ??= [];
|
|
28
|
+
config.optimizeDeps.esbuildOptions.plugins.push({
|
|
28
29
|
name: "rwsdk-state-external",
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
}
|
|
30
|
+
setup(build) {
|
|
31
|
+
build.onResolve({
|
|
32
|
+
// context(justinvdm, 13 Oct 2025): Vite dep optimizer slugifies the export path
|
|
33
|
+
filter: new RegExp(`^(${RW_STATE_EXPORT_PATH}|${VIRTUAL_STATE_PREFIX}.*)$`),
|
|
34
|
+
}, (args) => {
|
|
35
|
+
log("Marking as external: %s", args.path);
|
|
36
|
+
return {
|
|
37
|
+
path: args.path,
|
|
38
|
+
external: true,
|
|
39
|
+
};
|
|
40
|
+
});
|
|
34
41
|
},
|
|
35
42
|
});
|
|
36
43
|
}
|
|
@@ -105,9 +105,9 @@ export async function transformJsxScriptTagsCode(code, clientEntryPoints, manife
|
|
|
105
105
|
.forEach((callExpr) => {
|
|
106
106
|
const expression = callExpr.getExpression();
|
|
107
107
|
const expressionText = expression.getText();
|
|
108
|
-
if (
|
|
109
|
-
|
|
110
|
-
|
|
108
|
+
if (expressionText !== "jsx" &&
|
|
109
|
+
expressionText !== "jsxs" &&
|
|
110
|
+
expressionText !== "jsxDEV") {
|
|
111
111
|
return;
|
|
112
112
|
}
|
|
113
113
|
const args = callExpr.getArguments();
|
|
@@ -1,2 +1,153 @@
|
|
|
1
|
-
import type {
|
|
2
|
-
export declare const vitePreamblePlugin: () =>
|
|
1
|
+
import type { ResolvedConfig } from "vite";
|
|
2
|
+
export declare const vitePreamblePlugin: () => {
|
|
3
|
+
configResolved(config: ResolvedConfig): void;
|
|
4
|
+
hotUpdate?: import("rollup").ObjectHook<(this: import("rollup").MinimalPluginContext & {
|
|
5
|
+
environment: import("vite").DevEnvironment;
|
|
6
|
+
}, options: import("vite").HotUpdateOptions) => Array<import("vite").EnvironmentModuleNode> | void | Promise<Array<import("vite").EnvironmentModuleNode> | void>>;
|
|
7
|
+
resolveId?: import("rollup").ObjectHook<(this: import("rollup").PluginContext, source: string, importer: string | undefined, options: {
|
|
8
|
+
attributes: Record<string, string>;
|
|
9
|
+
custom?: import("rollup").CustomPluginOptions;
|
|
10
|
+
ssr?: boolean | undefined;
|
|
11
|
+
isEntry: boolean;
|
|
12
|
+
}) => Promise<import("rollup").ResolveIdResult> | import("rollup").ResolveIdResult, {
|
|
13
|
+
filter?: {
|
|
14
|
+
id?: RegExp | RegExp[] | {
|
|
15
|
+
include?: RegExp | RegExp[] | undefined;
|
|
16
|
+
exclude?: RegExp | RegExp[] | undefined;
|
|
17
|
+
};
|
|
18
|
+
};
|
|
19
|
+
}>;
|
|
20
|
+
load?: import("rollup").ObjectHook<(this: import("rollup").PluginContext, id: string, options?: {
|
|
21
|
+
ssr?: boolean | undefined;
|
|
22
|
+
}) => Promise<import("rollup").LoadResult> | import("rollup").LoadResult, {
|
|
23
|
+
filter?: {
|
|
24
|
+
id?: string | RegExp | (string | RegExp)[] | {
|
|
25
|
+
include?: string | RegExp | (string | RegExp)[] | undefined;
|
|
26
|
+
exclude?: string | RegExp | (string | RegExp)[] | undefined;
|
|
27
|
+
};
|
|
28
|
+
};
|
|
29
|
+
}>;
|
|
30
|
+
transform?: import("rollup").ObjectHook<(this: import("rollup").TransformPluginContext, code: string, id: string, options?: {
|
|
31
|
+
ssr?: boolean | undefined;
|
|
32
|
+
}) => Promise<import("rollup").TransformResult> | import("rollup").TransformResult, {
|
|
33
|
+
filter?: {
|
|
34
|
+
id?: string | RegExp | (string | RegExp)[] | {
|
|
35
|
+
include?: string | RegExp | (string | RegExp)[] | undefined;
|
|
36
|
+
exclude?: string | RegExp | (string | RegExp)[] | undefined;
|
|
37
|
+
};
|
|
38
|
+
code?: string | RegExp | (string | RegExp)[] | {
|
|
39
|
+
include?: string | RegExp | (string | RegExp)[] | undefined;
|
|
40
|
+
exclude?: string | RegExp | (string | RegExp)[] | undefined;
|
|
41
|
+
};
|
|
42
|
+
};
|
|
43
|
+
}>;
|
|
44
|
+
sharedDuringBuild?: boolean;
|
|
45
|
+
perEnvironmentStartEndDuringDev?: boolean;
|
|
46
|
+
perEnvironmentWatchChangeDuringDev?: boolean;
|
|
47
|
+
enforce?: "pre" | "post";
|
|
48
|
+
apply?: "serve" | "build" | ((this: void, config: import("vite").UserConfig, env: import("vite").ConfigEnv) => boolean);
|
|
49
|
+
applyToEnvironment?: (environment: {
|
|
50
|
+
name: string;
|
|
51
|
+
getTopLevelConfig(): ResolvedConfig;
|
|
52
|
+
config: ResolvedConfig & {
|
|
53
|
+
define?: Record<string, any>;
|
|
54
|
+
resolve: Required<import("vite").ResolveOptions>;
|
|
55
|
+
consumer: "client" | "server";
|
|
56
|
+
keepProcessEnv?: boolean;
|
|
57
|
+
optimizeDeps: import("vite").DepOptimizationOptions;
|
|
58
|
+
dev: import("vite").ResolvedDevEnvironmentOptions;
|
|
59
|
+
build: import("vite").ResolvedBuildEnvironmentOptions;
|
|
60
|
+
plugins: readonly import("vite").Plugin[];
|
|
61
|
+
};
|
|
62
|
+
logger: import("vite").Logger;
|
|
63
|
+
}) => boolean | Promise<boolean> | import("vite").PluginOption;
|
|
64
|
+
config?: import("rollup").ObjectHook<(this: import("vite").ConfigPluginContext, config: import("vite").UserConfig, env: import("vite").ConfigEnv) => Omit<import("vite").UserConfig, "plugins"> | null | void | Promise<Omit<import("vite").UserConfig, "plugins"> | null | void>>;
|
|
65
|
+
configEnvironment?: import("rollup").ObjectHook<(this: import("vite").ConfigPluginContext, name: string, config: import("vite").EnvironmentOptions, env: import("vite").ConfigEnv & {
|
|
66
|
+
isSsrTargetWebworker?: boolean;
|
|
67
|
+
}) => import("vite").EnvironmentOptions | null | void | Promise<import("vite").EnvironmentOptions | null | void>>;
|
|
68
|
+
configureServer?: import("rollup").ObjectHook<import("vite").ServerHook>;
|
|
69
|
+
configurePreviewServer?: import("rollup").ObjectHook<import("vite").PreviewServerHook>;
|
|
70
|
+
transformIndexHtml?: import("vite").IndexHtmlTransform;
|
|
71
|
+
buildApp?: import("rollup").ObjectHook<import("vite").BuildAppHook>;
|
|
72
|
+
handleHotUpdate?: import("rollup").ObjectHook<(this: import("vite").MinimalPluginContextWithoutEnvironment, ctx: import("vite").HmrContext) => Array<import("vite").ModuleNode> | void | Promise<Array<import("vite").ModuleNode> | void>>;
|
|
73
|
+
api?: any;
|
|
74
|
+
cacheKey?: string | undefined;
|
|
75
|
+
name: string;
|
|
76
|
+
version?: string | undefined;
|
|
77
|
+
renderError?: import("rollup").ObjectHook<(this: import("rollup").PluginContext, error?: Error | undefined) => void | Promise<void>, {
|
|
78
|
+
sequential?: boolean;
|
|
79
|
+
}> | undefined;
|
|
80
|
+
augmentChunkHash?: import("rollup").ObjectHook<(this: import("rollup").PluginContext, chunk: import("rollup").RenderedChunk) => string | void, {}> | undefined;
|
|
81
|
+
generateBundle?: import("rollup").ObjectHook<(this: import("rollup").PluginContext, options: import("rollup").NormalizedOutputOptions, bundle: import("rollup").OutputBundle, isWrite: boolean) => void | Promise<void>, {}> | undefined;
|
|
82
|
+
outputOptions?: import("rollup").ObjectHook<(this: import("rollup").PluginContext, options: import("rollup").OutputOptions) => import("rollup").OutputOptions | import("rollup").NullValue, {}> | undefined;
|
|
83
|
+
renderChunk?: import("rollup").ObjectHook<(this: import("rollup").PluginContext, code: string, chunk: import("rollup").RenderedChunk, options: import("rollup").NormalizedOutputOptions, meta: {
|
|
84
|
+
chunks: Record<string, import("rollup").RenderedChunk>;
|
|
85
|
+
}) => string | {
|
|
86
|
+
code: string;
|
|
87
|
+
map?: import("rollup").SourceMapInput;
|
|
88
|
+
} | import("rollup").NullValue | Promise<string | {
|
|
89
|
+
code: string;
|
|
90
|
+
map?: import("rollup").SourceMapInput;
|
|
91
|
+
} | import("rollup").NullValue>, {}> | undefined;
|
|
92
|
+
renderDynamicImport?: import("rollup").ObjectHook<(this: import("rollup").PluginContext, options: {
|
|
93
|
+
customResolution: string | null;
|
|
94
|
+
format: import("rollup").InternalModuleFormat;
|
|
95
|
+
moduleId: string;
|
|
96
|
+
targetModuleId: string | null;
|
|
97
|
+
chunk: import("rollup").PreRenderedChunkWithFileName;
|
|
98
|
+
targetChunk: import("rollup").PreRenderedChunkWithFileName | null;
|
|
99
|
+
getTargetChunkImports: () => import("rollup").DynamicImportTargetChunk[] | null;
|
|
100
|
+
targetModuleAttributes: Record<string, string>;
|
|
101
|
+
}) => {
|
|
102
|
+
left: string;
|
|
103
|
+
right: string;
|
|
104
|
+
} | import("rollup").NullValue, {}> | undefined;
|
|
105
|
+
renderStart?: import("rollup").ObjectHook<(this: import("rollup").PluginContext, outputOptions: import("rollup").NormalizedOutputOptions, inputOptions: import("rollup").NormalizedInputOptions) => void | Promise<void>, {
|
|
106
|
+
sequential?: boolean;
|
|
107
|
+
}> | undefined;
|
|
108
|
+
resolveFileUrl?: import("rollup").ObjectHook<import("rollup").ResolveFileUrlHook, {}> | undefined;
|
|
109
|
+
resolveImportMeta?: import("rollup").ObjectHook<import("rollup").ResolveImportMetaHook, {}> | undefined;
|
|
110
|
+
writeBundle?: import("rollup").ObjectHook<(this: import("rollup").PluginContext, options: import("rollup").NormalizedOutputOptions, bundle: import("rollup").OutputBundle) => void | Promise<void>, {
|
|
111
|
+
sequential?: boolean;
|
|
112
|
+
}> | undefined;
|
|
113
|
+
footer?: import("rollup").ObjectHook<import("rollup").AddonHook, {}> | undefined;
|
|
114
|
+
banner?: import("rollup").ObjectHook<import("rollup").AddonHook, {}> | undefined;
|
|
115
|
+
intro?: import("rollup").ObjectHook<import("rollup").AddonHook, {}> | undefined;
|
|
116
|
+
outro?: import("rollup").ObjectHook<import("rollup").AddonHook, {}> | undefined;
|
|
117
|
+
buildEnd?: import("rollup").ObjectHook<(this: import("rollup").PluginContext, error?: Error | undefined) => void | Promise<void>, {
|
|
118
|
+
sequential?: boolean;
|
|
119
|
+
}> | undefined;
|
|
120
|
+
buildStart?: import("rollup").ObjectHook<(this: import("rollup").PluginContext, options: import("rollup").NormalizedInputOptions) => void | Promise<void>, {
|
|
121
|
+
sequential?: boolean;
|
|
122
|
+
}> | undefined;
|
|
123
|
+
closeBundle?: import("rollup").ObjectHook<(this: import("rollup").PluginContext, error?: Error | undefined) => void | Promise<void>, {
|
|
124
|
+
sequential?: boolean;
|
|
125
|
+
}> | undefined;
|
|
126
|
+
closeWatcher?: import("rollup").ObjectHook<(this: import("rollup").PluginContext) => void | Promise<void>, {
|
|
127
|
+
sequential?: boolean;
|
|
128
|
+
}> | undefined;
|
|
129
|
+
moduleParsed?: import("rollup").ObjectHook<(this: import("rollup").PluginContext, info: import("rollup").ModuleInfo) => void | Promise<void>, {
|
|
130
|
+
sequential?: boolean;
|
|
131
|
+
}> | undefined;
|
|
132
|
+
onLog?: import("rollup").ObjectHook<(this: import("rollup").MinimalPluginContext, level: import("rollup").LogLevel, log: import("rollup").RollupLog) => boolean | import("rollup").NullValue, {}> | undefined;
|
|
133
|
+
options?: import("rollup").ObjectHook<(this: import("rollup").MinimalPluginContext, options: import("rollup").InputOptions) => import("rollup").InputOptions | import("rollup").NullValue | Promise<import("rollup").InputOptions | import("rollup").NullValue>, {}> | undefined;
|
|
134
|
+
resolveDynamicImport?: import("rollup").ObjectHook<(this: import("rollup").PluginContext, specifier: string | import("rollup").AstNode, importer: string, options: {
|
|
135
|
+
attributes: Record<string, string>;
|
|
136
|
+
importerAttributes: Record<string, string>;
|
|
137
|
+
}) => import("rollup").ResolveIdResult | Promise<import("rollup").ResolveIdResult>, {}> | undefined;
|
|
138
|
+
shouldTransformCachedModule?: import("rollup").ObjectHook<(this: import("rollup").PluginContext, options: {
|
|
139
|
+
ast: import("rollup").ProgramNode;
|
|
140
|
+
attributes: Record<string, string>;
|
|
141
|
+
code: string;
|
|
142
|
+
id: string;
|
|
143
|
+
meta: import("rollup").CustomPluginOptions;
|
|
144
|
+
moduleSideEffects: boolean | "no-treeshake";
|
|
145
|
+
resolvedSources: import("rollup").ResolvedIdMap;
|
|
146
|
+
syntheticNamedExports: boolean | string;
|
|
147
|
+
}) => boolean | import("rollup").NullValue | Promise<boolean | import("rollup").NullValue>, {}> | undefined;
|
|
148
|
+
watchChange?: import("rollup").ObjectHook<(this: import("rollup").PluginContext, id: string, change: {
|
|
149
|
+
event: import("rollup").ChangeEvent;
|
|
150
|
+
}) => void | Promise<void>, {
|
|
151
|
+
sequential?: boolean;
|
|
152
|
+
}> | undefined;
|
|
153
|
+
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "rwsdk",
|
|
3
|
-
"version": "1.2.
|
|
3
|
+
"version": "1.2.5",
|
|
4
4
|
"description": "Build fast, server-driven webapps on Cloudflare with SSR, RSC, and realtime",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"bin": {
|
|
@@ -154,7 +154,7 @@
|
|
|
154
154
|
"license": "MIT",
|
|
155
155
|
"dependencies": {
|
|
156
156
|
"@ast-grep/napi": "~0.42.1",
|
|
157
|
-
"@cloudflare/workers-types": "~4.
|
|
157
|
+
"@cloudflare/workers-types": "~4.20260426.1",
|
|
158
158
|
"@mdx-js/mdx": "~3.1.1",
|
|
159
159
|
"@puppeteer/browsers": "~2.13.0",
|
|
160
160
|
"@types/decompress": "~4.2.7",
|
|
@@ -163,12 +163,12 @@
|
|
|
163
163
|
"@types/react": "~19.2.14",
|
|
164
164
|
"@types/react-dom": "~19.2.3",
|
|
165
165
|
"@types/react-is": "~19.2.0",
|
|
166
|
-
"@vitejs/plugin-react": "~
|
|
166
|
+
"@vitejs/plugin-react": "~5.1.4",
|
|
167
167
|
"chokidar": "~5.0.0",
|
|
168
168
|
"debug": "~4.4.3",
|
|
169
169
|
"decompress": "~4.2.1",
|
|
170
|
-
"enhanced-resolve": "~5.
|
|
171
|
-
"eventsource-parser": "~3.0.
|
|
170
|
+
"enhanced-resolve": "~5.21.0",
|
|
171
|
+
"eventsource-parser": "~3.0.8",
|
|
172
172
|
"execa": "~9.6.1",
|
|
173
173
|
"find-up": "~8.0.0",
|
|
174
174
|
"fs-extra": "~11.3.4",
|
|
@@ -176,20 +176,21 @@
|
|
|
176
176
|
"glob": "~13.0.6",
|
|
177
177
|
"ignore": "~7.0.5",
|
|
178
178
|
"jsonc-parser": "~3.3.1",
|
|
179
|
-
"kysely": "~0.28.
|
|
179
|
+
"kysely": "~0.28.16",
|
|
180
180
|
"kysely-do": "~0.0.1-rc.1",
|
|
181
181
|
"lodash": "~4.18.1",
|
|
182
182
|
"magic-string": "~0.30.21",
|
|
183
183
|
"picocolors": "~1.1.1",
|
|
184
184
|
"proper-lockfile": "~4.1.2",
|
|
185
|
-
"puppeteer-core": "~24.
|
|
186
|
-
"react-is": "~19.2.
|
|
185
|
+
"puppeteer-core": "~24.42.0",
|
|
186
|
+
"react-is": "~19.2.5",
|
|
187
187
|
"rsc-html-stream": "~0.0.7",
|
|
188
188
|
"server-only": "^0.0.1",
|
|
189
189
|
"tmp-promise": "~3.0.3",
|
|
190
|
-
"ts-morph": "~
|
|
190
|
+
"ts-morph": "~28.0.0",
|
|
191
191
|
"unique-names-generator": "~4.7.1",
|
|
192
|
-
"vibe-rules": "~0.3.91"
|
|
192
|
+
"vibe-rules": "~0.3.91",
|
|
193
|
+
"vite-tsconfig-paths": "~6.1.1"
|
|
193
194
|
},
|
|
194
195
|
"peerDependencies": {
|
|
195
196
|
"@cloudflare/vite-plugin": "^1.26.1",
|
|
@@ -197,7 +198,7 @@
|
|
|
197
198
|
"react": ">=19.2.0-0 <19.3.0 || >=19.3.0-0 <20.0.0",
|
|
198
199
|
"react-dom": ">=19.2.0-0 <19.3.0 || >=19.3.0-0 <20.0.0",
|
|
199
200
|
"react-server-dom-webpack": ">=19.2.0-0 <19.3.0 || >=19.3.0-0 <20.0.0",
|
|
200
|
-
"vite": "^6.2.6 || 7.x
|
|
201
|
+
"vite": "^6.2.6 || 7.x",
|
|
201
202
|
"wrangler": "^4.77.0"
|
|
202
203
|
},
|
|
203
204
|
"peerDependenciesMeta": {
|
|
@@ -207,19 +208,19 @@
|
|
|
207
208
|
},
|
|
208
209
|
"packageManager": "pnpm@10.31.0",
|
|
209
210
|
"devDependencies": {
|
|
210
|
-
"@cloudflare/vite-plugin": "1.
|
|
211
|
-
"wrangler": "^4.
|
|
211
|
+
"@cloudflare/vite-plugin": "1.33.2",
|
|
212
|
+
"wrangler": "^4.85.0",
|
|
212
213
|
"capnweb": "~0.5.0",
|
|
213
214
|
"@types/debug": "~4.1.13",
|
|
214
215
|
"@types/js-beautify": "~1.14.3",
|
|
215
216
|
"@types/lodash": "~4.17.24",
|
|
216
|
-
"@types/node": "~25.
|
|
217
|
+
"@types/node": "~25.6.0",
|
|
217
218
|
"@types/proper-lockfile": "~4.1.4",
|
|
218
219
|
"js-beautify": "~1.15.4",
|
|
219
220
|
"semver": "~7.7.4",
|
|
220
221
|
"tsx": "~4.21.0",
|
|
221
|
-
"typescript": "~6.0.
|
|
222
|
-
"vite": "~
|
|
223
|
-
"vitest": "~4.1.
|
|
222
|
+
"typescript": "~6.0.3",
|
|
223
|
+
"vite": "~7.3.2",
|
|
224
|
+
"vitest": "~4.1.5"
|
|
224
225
|
}
|
|
225
226
|
}
|
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
import type { EnvironmentOptions } from "vite";
|
|
2
|
-
interface OptimizeDepsPlugin {
|
|
3
|
-
name: string;
|
|
4
|
-
resolveId?: (id: string, importer: string | undefined, opts: {
|
|
5
|
-
kind: string;
|
|
6
|
-
}) => any;
|
|
7
|
-
load?: (id: string) => any;
|
|
8
|
-
}
|
|
9
|
-
export declare function addOptimizeDepsPlugin(config: EnvironmentOptions, plugin: OptimizeDepsPlugin): void;
|
|
10
|
-
export {};
|