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.
Files changed (93) hide show
  1. package/dist/lib/constants.d.mts +6 -1
  2. package/dist/lib/constants.mjs +6 -1
  3. package/dist/lib/smokeTests/browser.mjs +5 -21
  4. package/dist/lib/smokeTests/codeUpdates.d.mts +1 -1
  5. package/dist/lib/smokeTests/codeUpdates.mjs +41 -5
  6. package/dist/lib/smokeTests/development.d.mts +1 -1
  7. package/dist/lib/smokeTests/development.mjs +4 -10
  8. package/dist/lib/smokeTests/release.d.mts +1 -1
  9. package/dist/lib/smokeTests/release.mjs +4 -9
  10. package/dist/lib/smokeTests/runSmokeTests.mjs +2 -2
  11. package/dist/lib/smokeTests/templates/SmokeTest.template.js +3 -2
  12. package/dist/lib/testUtils/stubEnvVars.d.mts +2 -0
  13. package/dist/lib/testUtils/stubEnvVars.mjs +11 -0
  14. package/dist/runtime/client/client.d.ts +10 -0
  15. package/dist/runtime/{client.js → client/client.js} +13 -10
  16. package/dist/runtime/{clientNavigation.test.js → client/navigation.test.js} +1 -1
  17. package/dist/runtime/client/setWebpackRequire.d.ts +1 -0
  18. package/dist/runtime/client/setWebpackRequire.js +2 -0
  19. package/dist/runtime/{client.d.ts → client/types.d.ts} +4 -10
  20. package/dist/runtime/client/types.js +1 -0
  21. package/dist/runtime/entries/client.d.ts +2 -2
  22. package/dist/runtime/entries/client.js +2 -2
  23. package/dist/runtime/imports/client.d.ts +3 -3
  24. package/dist/runtime/imports/client.js +11 -15
  25. package/dist/runtime/imports/ssr.d.ts +3 -3
  26. package/dist/runtime/imports/ssr.js +3 -3
  27. package/dist/runtime/imports/worker.d.ts +3 -3
  28. package/dist/runtime/imports/worker.js +5 -4
  29. package/dist/runtime/lib/manifest.d.ts +11 -2
  30. package/dist/runtime/lib/manifest.js +1 -1
  31. package/dist/runtime/lib/memoizeOnId.d.ts +1 -0
  32. package/dist/runtime/lib/memoizeOnId.js +11 -0
  33. package/dist/runtime/lib/realtime/client.d.ts +1 -1
  34. package/dist/runtime/lib/realtime/client.js +1 -1
  35. package/dist/runtime/lib/router.d.ts +3 -3
  36. package/dist/runtime/lib/router.js +77 -33
  37. package/dist/runtime/register/ssr.d.ts +1 -1
  38. package/dist/runtime/register/ssr.js +4 -3
  39. package/dist/runtime/render/preloads.d.ts +6 -0
  40. package/dist/runtime/render/preloads.js +40 -0
  41. package/dist/runtime/render/renderRscThenableToHtmlStream.js +2 -1
  42. package/dist/runtime/render/stylesheets.js +1 -1
  43. package/dist/runtime/requestInfo/types.d.ts +3 -1
  44. package/dist/runtime/requestInfo/worker.js +9 -1
  45. package/dist/runtime/worker.d.ts +0 -3
  46. package/dist/runtime/worker.js +2 -11
  47. package/dist/scripts/debug-sync.mjs +142 -39
  48. package/dist/scripts/smoke-test.mjs +0 -10
  49. package/dist/scripts/worker-run.mjs +8 -3
  50. package/dist/vite/buildApp.d.mts +15 -0
  51. package/dist/vite/buildApp.mjs +53 -0
  52. package/dist/vite/configPlugin.d.mts +4 -2
  53. package/dist/vite/configPlugin.mjs +69 -62
  54. package/dist/vite/createDirectiveLookupPlugin.d.mts +0 -6
  55. package/dist/vite/createDirectiveLookupPlugin.mjs +61 -145
  56. package/dist/vite/directiveModulesDevPlugin.d.mts +8 -0
  57. package/dist/vite/directiveModulesDevPlugin.mjs +62 -0
  58. package/dist/vite/directivesFilteringPlugin.d.mts +6 -0
  59. package/dist/vite/directivesFilteringPlugin.mjs +31 -0
  60. package/dist/vite/directivesPlugin.mjs +28 -42
  61. package/dist/vite/getViteEsbuild.d.mts +1 -0
  62. package/dist/vite/getViteEsbuild.mjs +12 -0
  63. package/dist/vite/hasOwnReactVitePlugin.d.mts +3 -0
  64. package/dist/vite/hasOwnReactVitePlugin.mjs +14 -0
  65. package/dist/vite/injectVitePreamblePlugin.d.mts +3 -2
  66. package/dist/vite/injectVitePreamblePlugin.mjs +4 -2
  67. package/dist/vite/linkerPlugin.d.mts +4 -0
  68. package/dist/vite/linkerPlugin.mjs +41 -0
  69. package/dist/vite/manifestPlugin.d.mts +2 -2
  70. package/dist/vite/manifestPlugin.mjs +12 -37
  71. package/dist/vite/miniflareHMRPlugin.mjs +17 -2
  72. package/dist/vite/moveStaticAssetsPlugin.mjs +2 -1
  73. package/dist/vite/prismaPlugin.mjs +1 -1
  74. package/dist/vite/reactConditionsResolverPlugin.d.mts +3 -4
  75. package/dist/vite/reactConditionsResolverPlugin.mjs +74 -56
  76. package/dist/vite/redwoodPlugin.d.mts +1 -1
  77. package/dist/vite/redwoodPlugin.mjs +36 -12
  78. package/dist/vite/runDirectivesScan.d.mts +7 -0
  79. package/dist/vite/runDirectivesScan.mjs +152 -0
  80. package/dist/vite/ssrBridgePlugin.mjs +13 -14
  81. package/dist/vite/transformClientComponents.d.mts +0 -1
  82. package/dist/vite/transformClientComponents.mjs +1 -9
  83. package/dist/vite/transformJsxScriptTagsPlugin.d.mts +4 -3
  84. package/dist/vite/transformJsxScriptTagsPlugin.mjs +151 -158
  85. package/dist/vite/transformJsxScriptTagsPlugin.test.mjs +393 -136
  86. package/dist/vite/transformServerFunctions.d.mts +1 -1
  87. package/dist/vite/transformServerFunctions.mjs +11 -12
  88. package/package.json +28 -4
  89. /package/dist/runtime/{imports → client}/ClientOnly.d.ts +0 -0
  90. /package/dist/runtime/{imports → client}/ClientOnly.js +0 -0
  91. /package/dist/runtime/{clientNavigation.d.ts → client/navigation.d.ts} +0 -0
  92. /package/dist/runtime/{clientNavigation.js → client/navigation.js} +0 -0
  93. /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>, addServerModule?: (environment: string, id: string) => void) => TransformResult | undefined;
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, addServerModule) => {
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
- log("Processing 'use server' module: normalizedId=%s, environment=%s", normalizedId, environment);
97
- addServerModule?.(environment, normalizedId);
91
+ process.env.VERBOSE &&
92
+ log("Processing 'use server' module: normalizedId=%s, environment=%s", normalizedId, environment);
98
93
  if (environment === "ssr" || environment === "client") {
99
- log(`Transforming for ${environment} environment: normalizedId=%s`, normalizedId);
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
- log(`${environment} transformation complete for normalizedId=%s`, normalizedId);
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
- log("Transforming for worker environment: normalizedId=%s", normalizedId);
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
- log("Worker transformation complete for normalizedId=%s", normalizedId);
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.2.0-alpha.9",
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