rwsdk 0.2.0-alpha.9 → 0.3.0
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/lib/constants.d.mts +6 -1
- package/dist/lib/constants.mjs +6 -1
- package/dist/lib/smokeTests/browser.mjs +5 -21
- package/dist/lib/smokeTests/codeUpdates.d.mts +1 -1
- package/dist/lib/smokeTests/codeUpdates.mjs +41 -5
- package/dist/lib/smokeTests/development.d.mts +1 -1
- package/dist/lib/smokeTests/development.mjs +4 -10
- package/dist/lib/smokeTests/release.d.mts +1 -1
- package/dist/lib/smokeTests/release.mjs +4 -9
- package/dist/lib/smokeTests/runSmokeTests.mjs +2 -2
- package/dist/lib/smokeTests/templates/SmokeTest.template.js +3 -2
- package/dist/lib/testUtils/stubEnvVars.d.mts +2 -0
- package/dist/lib/testUtils/stubEnvVars.mjs +11 -0
- package/dist/runtime/client/client.d.ts +10 -0
- package/dist/runtime/{client.js → client/client.js} +13 -10
- package/dist/runtime/{clientNavigation.test.js → client/navigation.test.js} +1 -1
- package/dist/runtime/client/setWebpackRequire.d.ts +1 -0
- package/dist/runtime/client/setWebpackRequire.js +2 -0
- package/dist/runtime/{client.d.ts → client/types.d.ts} +4 -10
- package/dist/runtime/client/types.js +1 -0
- package/dist/runtime/entries/client.d.ts +2 -2
- package/dist/runtime/entries/client.js +2 -2
- package/dist/runtime/imports/client.d.ts +3 -3
- package/dist/runtime/imports/client.js +11 -15
- package/dist/runtime/imports/ssr.d.ts +3 -3
- package/dist/runtime/imports/ssr.js +3 -3
- package/dist/runtime/imports/worker.d.ts +3 -3
- package/dist/runtime/imports/worker.js +5 -4
- package/dist/runtime/lib/manifest.d.ts +11 -2
- package/dist/runtime/lib/manifest.js +1 -1
- package/dist/runtime/lib/memoizeOnId.d.ts +1 -0
- package/dist/runtime/lib/memoizeOnId.js +11 -0
- package/dist/runtime/lib/realtime/client.d.ts +1 -1
- package/dist/runtime/lib/realtime/client.js +1 -1
- package/dist/runtime/lib/router.d.ts +3 -3
- package/dist/runtime/lib/router.js +77 -33
- package/dist/runtime/register/ssr.d.ts +1 -1
- package/dist/runtime/register/ssr.js +4 -3
- package/dist/runtime/render/preloads.d.ts +6 -0
- package/dist/runtime/render/preloads.js +40 -0
- package/dist/runtime/render/renderRscThenableToHtmlStream.js +2 -1
- package/dist/runtime/render/stylesheets.js +1 -1
- package/dist/runtime/requestInfo/types.d.ts +3 -1
- package/dist/runtime/requestInfo/worker.js +9 -1
- package/dist/runtime/worker.d.ts +0 -3
- package/dist/runtime/worker.js +2 -11
- package/dist/scripts/debug-sync.mjs +142 -39
- package/dist/scripts/smoke-test.mjs +0 -10
- package/dist/scripts/worker-run.mjs +8 -3
- package/dist/vite/buildApp.d.mts +15 -0
- package/dist/vite/buildApp.mjs +53 -0
- package/dist/vite/configPlugin.d.mts +4 -2
- package/dist/vite/configPlugin.mjs +69 -62
- package/dist/vite/createDirectiveLookupPlugin.d.mts +0 -6
- package/dist/vite/createDirectiveLookupPlugin.mjs +61 -145
- package/dist/vite/directiveModulesDevPlugin.d.mts +8 -0
- package/dist/vite/directiveModulesDevPlugin.mjs +62 -0
- package/dist/vite/directivesFilteringPlugin.d.mts +6 -0
- package/dist/vite/directivesFilteringPlugin.mjs +31 -0
- package/dist/vite/directivesPlugin.mjs +28 -42
- package/dist/vite/getViteEsbuild.d.mts +1 -0
- package/dist/vite/getViteEsbuild.mjs +12 -0
- package/dist/vite/hasOwnReactVitePlugin.d.mts +3 -0
- package/dist/vite/hasOwnReactVitePlugin.mjs +14 -0
- package/dist/vite/injectVitePreamblePlugin.d.mts +3 -2
- package/dist/vite/injectVitePreamblePlugin.mjs +4 -2
- package/dist/vite/linkerPlugin.d.mts +4 -0
- package/dist/vite/linkerPlugin.mjs +41 -0
- package/dist/vite/manifestPlugin.d.mts +2 -2
- package/dist/vite/manifestPlugin.mjs +12 -37
- package/dist/vite/miniflareHMRPlugin.mjs +17 -2
- package/dist/vite/moveStaticAssetsPlugin.mjs +2 -1
- package/dist/vite/prismaPlugin.mjs +1 -1
- package/dist/vite/reactConditionsResolverPlugin.d.mts +3 -4
- package/dist/vite/reactConditionsResolverPlugin.mjs +74 -56
- package/dist/vite/redwoodPlugin.d.mts +1 -1
- package/dist/vite/redwoodPlugin.mjs +36 -12
- package/dist/vite/runDirectivesScan.d.mts +7 -0
- package/dist/vite/runDirectivesScan.mjs +152 -0
- package/dist/vite/ssrBridgePlugin.mjs +13 -14
- package/dist/vite/transformClientComponents.d.mts +0 -1
- package/dist/vite/transformClientComponents.mjs +1 -9
- package/dist/vite/transformJsxScriptTagsPlugin.d.mts +4 -3
- package/dist/vite/transformJsxScriptTagsPlugin.mjs +151 -158
- package/dist/vite/transformJsxScriptTagsPlugin.test.mjs +393 -136
- package/dist/vite/transformServerFunctions.d.mts +1 -1
- package/dist/vite/transformServerFunctions.mjs +11 -12
- package/package.json +28 -4
- /package/dist/runtime/{imports → client}/ClientOnly.d.ts +0 -0
- /package/dist/runtime/{imports → client}/ClientOnly.js +0 -0
- /package/dist/runtime/{clientNavigation.d.ts → client/navigation.d.ts} +0 -0
- /package/dist/runtime/{clientNavigation.js → client/navigation.js} +0 -0
- /package/dist/runtime/{clientNavigation.test.d.ts → client/navigation.test.d.ts} +0 -0
|
@@ -12,5 +12,5 @@ type ExportInfoCompat = {
|
|
|
12
12
|
};
|
|
13
13
|
export declare const findExportedFunctions: (code: string, normalizedId?: string) => Set<string>;
|
|
14
14
|
export declare const findExportInfo: (code: string, normalizedId?: string) => ExportInfoCompat;
|
|
15
|
-
export declare const transformServerFunctions: (code: string, normalizedId: string, environment: "client" | "worker" | "ssr", serverFiles?: Set<string
|
|
15
|
+
export declare const transformServerFunctions: (code: string, normalizedId: string, environment: "client" | "worker" | "ssr", serverFiles?: Set<string>) => TransformResult | undefined;
|
|
16
16
|
export type { TransformResult };
|
|
@@ -84,19 +84,15 @@ function hasDefaultExport(code, normalizedId) {
|
|
|
84
84
|
}
|
|
85
85
|
return false;
|
|
86
86
|
}
|
|
87
|
-
export const transformServerFunctions = (code, normalizedId, environment, serverFiles
|
|
88
|
-
process.env.VERBOSE &&
|
|
89
|
-
log("Transform server functions called for normalizedId=%s, environment=%s", normalizedId, environment);
|
|
87
|
+
export const transformServerFunctions = (code, normalizedId, environment, serverFiles) => {
|
|
90
88
|
if (!hasDirective(code, "use server")) {
|
|
91
|
-
log("Skipping: no 'use server' directive in id=%s", normalizedId);
|
|
92
|
-
process.env.VERBOSE &&
|
|
93
|
-
log(":VERBOSE: Returning code unchanged for id=%s:\n%s", normalizedId, code);
|
|
94
89
|
return;
|
|
95
90
|
}
|
|
96
|
-
|
|
97
|
-
|
|
91
|
+
process.env.VERBOSE &&
|
|
92
|
+
log("Processing 'use server' module: normalizedId=%s, environment=%s", normalizedId, environment);
|
|
98
93
|
if (environment === "ssr" || environment === "client") {
|
|
99
|
-
|
|
94
|
+
process.env.VERBOSE &&
|
|
95
|
+
log(`Transforming for ${environment} environment: normalizedId=%s`, normalizedId);
|
|
100
96
|
const exportInfo = findExportInfo(code, normalizedId);
|
|
101
97
|
const allExports = new Set([
|
|
102
98
|
...exportInfo.localFunctions,
|
|
@@ -126,7 +122,8 @@ export const transformServerFunctions = (code, normalizedId, environment, server
|
|
|
126
122
|
s.append(`\nexport default createServerReference(${JSON.stringify(normalizedId)}, "default");\n`);
|
|
127
123
|
log(`Added ${environment} server reference for default export in normalizedId=%s`, normalizedId);
|
|
128
124
|
}
|
|
129
|
-
|
|
125
|
+
process.env.VERBOSE &&
|
|
126
|
+
log(`${environment} transformation complete for normalizedId=%s`, normalizedId);
|
|
130
127
|
return {
|
|
131
128
|
code: s.toString(),
|
|
132
129
|
map: s.generateMap({
|
|
@@ -137,7 +134,8 @@ export const transformServerFunctions = (code, normalizedId, environment, server
|
|
|
137
134
|
};
|
|
138
135
|
}
|
|
139
136
|
else if (environment === "worker") {
|
|
140
|
-
|
|
137
|
+
process.env.VERBOSE &&
|
|
138
|
+
log("Transforming for worker environment: normalizedId=%s", normalizedId);
|
|
141
139
|
const exportInfo = findExportInfo(code, normalizedId);
|
|
142
140
|
const s = new MagicString(code);
|
|
143
141
|
// Remove "use server" directive first
|
|
@@ -281,7 +279,8 @@ export const transformServerFunctions = (code, normalizedId, environment, server
|
|
|
281
279
|
if (registrationCalls.length > 0) {
|
|
282
280
|
s.append(registrationCalls.join("\n") + "\n");
|
|
283
281
|
}
|
|
284
|
-
|
|
282
|
+
process.env.VERBOSE &&
|
|
283
|
+
log("Worker transformation complete for normalizedId=%s", normalizedId);
|
|
285
284
|
return {
|
|
286
285
|
code: s.toString(),
|
|
287
286
|
map: s.generateMap({
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "rwsdk",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.3.0",
|
|
4
4
|
"description": "Build fast, server-driven webapps on Cloudflare with SSR, RSC, and realtime",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"bin": {
|
|
@@ -45,6 +45,12 @@
|
|
|
45
45
|
"types": "./dist/runtime/ssrBridge.d.ts",
|
|
46
46
|
"default": "./dist/runtime/ssrBridge.js"
|
|
47
47
|
},
|
|
48
|
+
"./__client_barrel": {
|
|
49
|
+
"default": "./dist/__intermediate_builds/rwsdk-client-barrel.js"
|
|
50
|
+
},
|
|
51
|
+
"./__server_barrel": {
|
|
52
|
+
"default": "./dist/__intermediate_builds/rwsdk-server-barrel.js"
|
|
53
|
+
},
|
|
48
54
|
"./router": {
|
|
49
55
|
"types": "./dist/runtime/entries/router.d.ts",
|
|
50
56
|
"default": "./dist/runtime/entries/router.js"
|
|
@@ -144,10 +150,7 @@
|
|
|
144
150
|
"picocolors": "^1.1.1",
|
|
145
151
|
"proper-lockfile": "^4.1.2",
|
|
146
152
|
"puppeteer-core": "^22.8.1",
|
|
147
|
-
"react": "19.2.0-canary-39cad7af-20250411",
|
|
148
|
-
"react-dom": "19.2.0-canary-39cad7af-20250411",
|
|
149
153
|
"react-is": "^19.0.0",
|
|
150
|
-
"react-server-dom-webpack": "19.2.0-canary-39cad7af-20250411",
|
|
151
154
|
"rsc-html-stream": "^0.0.6",
|
|
152
155
|
"tmp-promise": "^3.0.3",
|
|
153
156
|
"ts-morph": "^25.0.1",
|
|
@@ -157,14 +160,35 @@
|
|
|
157
160
|
"wrangler": "^4.20.5"
|
|
158
161
|
},
|
|
159
162
|
"peerDependencies": {
|
|
163
|
+
"react": ">=19.2.0-0 <20",
|
|
164
|
+
"react-dom": ">=19.2.0-0 <20",
|
|
165
|
+
"react-server-dom-webpack": ">=19.2.0-0 <20",
|
|
160
166
|
"vite": "^6.2.6"
|
|
161
167
|
},
|
|
168
|
+
"optionalDependencies": {
|
|
169
|
+
"react": "19.2.0-canary-39cad7af-20250411",
|
|
170
|
+
"react-dom": "19.2.0-canary-39cad7af-20250411",
|
|
171
|
+
"react-server-dom-webpack": "19.2.0-canary-39cad7af-20250411"
|
|
172
|
+
},
|
|
173
|
+
"peerDependenciesMeta": {
|
|
174
|
+
"react": {
|
|
175
|
+
"optional": true
|
|
176
|
+
},
|
|
177
|
+
"react-dom": {
|
|
178
|
+
"optional": true
|
|
179
|
+
},
|
|
180
|
+
"react-server-dom-webpack": {
|
|
181
|
+
"optional": true
|
|
182
|
+
}
|
|
183
|
+
},
|
|
162
184
|
"packageManager": "pnpm@9.14.4+sha512.c8180b3fbe4e4bca02c94234717896b5529740a6cbadf19fa78254270403ea2f27d4e1d46a08a0f56c89b63dc8ebfd3ee53326da720273794e6200fcf0d184ab",
|
|
163
185
|
"devDependencies": {
|
|
164
186
|
"@types/debug": "^4.1.12",
|
|
187
|
+
"@types/js-beautify": "^1.14.3",
|
|
165
188
|
"@types/lodash": "^4.17.16",
|
|
166
189
|
"@types/node": "^22.14.0",
|
|
167
190
|
"@types/proper-lockfile": "^4.1.4",
|
|
191
|
+
"js-beautify": "^1.15.4",
|
|
168
192
|
"semver": "^7.7.1",
|
|
169
193
|
"tsx": "^4.19.4",
|
|
170
194
|
"typescript": "^5.8.3",
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|